If the object already exists it will never be moved. I use this pattern:static string TKcLow = "Tokyo Channel Low"; #define WINDOW_MAIN 0 if(!ObjectMove(TKcLow, 0, TimeWellington, TKcPrcLow)) if (!ObjectCreate( TKcLow, OBJ_HLINE, WINDOW_MAIN , TimeWellington, TKcPrcLow)) Alert( "ObjectCreate(", TKcLow,",HLINE) [2] failed: ",GetLastError() ); else if (!ObjectSet( TKcLow, OBJPROP_COLOR, Color.TKc )) Alert( "ObjectSet(", TKcLow, ",Color) [3] failed: ", GetLastError() );
Reversal_line_val=Renko+(250/10000);
Don't hard code constantsReversal_line_val=Renko+ 250*Point;
WHRoeder:
If the object already exists it will never be moved. I use this pattern:
Don't hard code constants
Hi,
Thanks
I have amended my programme, the only thing that I find is how to add a line to check for the existence of the horizontal line object during redraw, if the horizontal line is in existence, it must be destroy before re-create again to ensure the new horizontal line object could be display property in the chart .
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
Hi,
I have the following code written in expert adviser, not sure why the line would not draw?
Appreciate if anyone can help
The external value Renko would be manually input, as well as the Reversal_colour during startup.
extern double Renko;
extern color Reversal_colour=Blue;
int start()
{
double Reversal_line_val;
if (Reversal_colour==Blue)
Reversal_line_val=Renko+(250/10000);
if (Reversal_colour==Red)
Reversal_line_val=Renko-(250/10000);
Alert("Reveral_line_val = ",Reversal_line_val);
ObjectCreate("Reversal_line",OBJ_HLINE,0,0,Reversal_line_val);
ObjectSet("Reversal_line",OBJPROP_COLOR,Reversal_colour);
Comment("Reversal =",Reversal_line_val);
MessageBox("Reversal =",Reversal_line_val);
Print("Reversal =",Reversal_line_val);
//WindowRedraw();
return (0);