I don't think you can trap the close of the last candle, only the start of the current.
//---- go trading only for first tiks of new bar
if(Volume[0]>1) return;
This should be the same thing, just about.
//---- go trading only for first tiks of new bar
if(Volume[0]>1) return;
This should be the same thing, just about.
wanderful!
tried it. still doesnt seem to work
the actual script is
if(Volume[0]>1)
{
ObjectsRedraw();
}
return(0);
show draw the horizontal lines at new candle open.
would it be :
Volume[0]==1 ?
how about getting the price at Volume[0]>1 ?
and the price at the close of the previous candle?
is it close[1]?
tried it. still doesnt seem to work
the actual script is
if(Volume[0]>1)
{
ObjectsRedraw();
}
return(0);
show draw the horizontal lines at new candle open.
would it be :
Volume[0]==1 ?
how about getting the price at Volume[0]>1 ?
and the price at the close of the previous candle?
is it close[1]?
An alternative is to recognise that the invocation is caused by the first tick on
a bar, which you'd do with a code fragment like the following:
That snippet works well for an expert, but not totally well for an indicator, because an indicator can be reinvoked for old bars, e.g., when the window is scrolled or reshaped or something. In that case, the template code would perhaps look something like the following:
static datetime time = 0; // This assignment only happens the very first time if ( time == Time[0] ) { // Current invocation is another tick for the same bar 0 as before return( 0 ); } // Current invocation is the first invocation for this bar 0 time = Time[0];
That snippet works well for an expert, but not totally well for an indicator, because an indicator can be reinvoked for old bars, e.g., when the window is scrolled or reshaped or something. In that case, the template code would perhaps look something like the following:
int start() { int bar = Bars - IndicatorCounted(); if ( bar > 0 ) { // Indicator is invoked for other reason than new tick, to inicate past bars for ( ; bar > 1; bar-- ) { indicate( bar ); } } // Maybe paint bar 1... static datetime time = 0; // This assignment only happens the very first time if ( time == Time[0] ) return( 0 ); // Current bar 1 has already been set time = Time[0]; indicate( 1 ); // This invocation is the first time current bar 0 is seen return( 0 ); } void indicate(int bar) { // .... actual code to indicate for the given bar (which is closed) }But I haven't worked with indicators much and there may be other intricacies involved.
great stuff richplank, i'll give it a try. i must say, i cant understand the script
you posted. seems complicated.
You are correct...
if(Volume[0]>1)
{
ObjectsRedraw();
}
return(0);
will only draw after the first tick
if(Volume[0]==1)
{
ObjectsRedraw();
}
return(0);
would be a better idea.
if(Volume[0]>1)
{
ObjectsRedraw();
}
return(0);
will only draw after the first tick
if(Volume[0]==1)
{
ObjectsRedraw();
}
return(0);
would be a better idea.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
i tried this for the indicator
if (close[1]== true)
{
ObjectsRedraw();
}
but it doesnt work. doesnt redraw on candle close
i tried these for the expert
if (Close[0] > SessionHigh)
and
if (Close[1] > SessionHigh)
and
if (Open[0] > SessionHigh)
this doesnt work, it runs on every tick even on a 15 min chart.
any help appreciated! thank you.