string name_rect = "Support"; double S_Candle_High = iHigh(NULL,PERIOD_H1,10); double S_Candle_Low = iLow(NULL,PERIOD_H1,10); bool Support_Rectangle = ObjectCreate(name_rect,OBJ_RECTANGLE,0,Time[15],S_Candle_High,TimeCurrent(),S_Candle_Low,0,0); if (!Support_Rectangle) { Print("Failed to create Rectangle_Support. Error code= ",GetLastError() ); return(0);}
If you indented your code, it would be much easier to read and find errors. Not only for us, but for you as well.
If the first object exists, then start() would only run as far as the return(0), so whether the 2nd object exists or not, the code to create it will not be executed.
Create the objects in init.
If you indented your code, it would be much easier to read and find errors. Not only for us, but for you as well.
If the first object exists, then start() would only run as far as the return(0), so whether the 2nd object exists or not, the code to create it will not be executed.
Create the objects in init.
Hi,
Thank you for your help.... Ps. I did not intend code... I simply forgot to add global variable part.
I wasn't aware of the return(0) function was stopping the EA to run. So I put this line into comment "//..." and now it works fine.
I created the name of rectangle ading "_Symbol" to get 2 rectangles names per chart.
When I do CTRL+B when EA creates an pending orders... It adds 3 objects called Arrow (Pending price, SL, TP)...
Is there any way to cancel thoses objects, so it only contains my rectangles? ---> I know I can delete them but I would like it won't get messy all time
Hi,
Thank you for your help.... Ps. I did not intend code... I simply forgot to add global variable part.
I wasn't aware of the return(0) function was stopping the EA to run. So I put this line into comment "//..." and now it works fine.
I created the name of rectangle ading "_Symbol" to get 2 rectangles names per chart.
When I do CTRL+B when EA creates an pending orders... It adds 3 objects called Arrow (Pending price, SL, TP)...
Is there any way to cancel thoses objects, so it only contains my rectangles? ---> I know I can delete them but I would like it won't get messy all time
You don't seem to understand what indented code is.
This is an absolute mess
if (S_time1<S_time2) {datetime Var_S_Time1=S_time1; datetime Var_S_Time2=S_time2;} else {Var_S_Time1=S_time2; Var_S_Time2=S_time1; } if (S_Price1<S_Price2) {double Var_S_Price1=S_Price1; double Var_S_Price2=S_Price2;} else {Var_S_Price1=S_Price2; Var_S_Price2=S_Price1; } Print("Support: time1=",Var_S_Time1," Price1=",Var_S_Price1," time2=",Var_S_Time2," Price2=",Var_S_Price2);
This is much easier to follow
if (S_time1<S_time2) { datetime Var_S_Time1=S_time1; datetime Var_S_Time2=S_time2; } else { Var_S_Time1=S_time2; Var_S_Time2=S_time1; } if (S_Price1<S_Price2) { double Var_S_Price1=S_Price1; double Var_S_Price2=S_Price2; } else { Var_S_Price1=S_Price2; Var_S_Price2=S_Price1; } Print("Support: time1=",Var_S_Time1," Price1=",Var_S_Price1," time2=",Var_S_Time2," Price2=",Var_S_Price2);
If you post messy undisciplined code, you are less likely to find anyone to help you.
You don't seem to understand what indented code is.
This is an absolute mess
This is much easier to follow
If you post messy undisciplined code, you are less likely to find anyone to help you.
Humm Ok I got it now : )
Any clue about this?
When I do CTRL+B to check objects, whenever EA creates a pending orders... It adds 3 objects called Arrow (Pending Price, SL, TP)... Could we disable those objects creation.
Humm Ok I got it now : )
Any clue about this?
When I do CTRL+B to check objects, whenever EA creates a pending orders... It adds 3 objects called Arrow (Pending Price, SL, TP)... Could we disable those objects creation.
Using Ctrl F, I can only find 2 ObjectCreate() in your posted code and they are both rectangles.
Find the ObjectCreate's that paint the arrows and remove the code that creates them along with any related ObjectSet code.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I have muliples weird things while I try to create 2 simples Rectangles object:
Both are created fine when I attach EA to the chart but:
1 ) When EA tries to create again and again the first one rectangle (Support) so I got error 4200 (Object already exist): with the print function.
2 ) CTRL+B I deleted both rectangles then EA re creates both rectangles but the previous error still happens
3 ) If I delete Support rectangle... EA will re create the object while If I delete Resistance Rectangle EA won't re create it.... It will only if both are missing. So it means that the problem may come from in fact from the second object.
4 ) Even If I use Objectdelete() function into desinitialisation... when I take it of the EA, both object stay on chart?
5 ) Also i notice that the Print function only works when it draws Rectangles on chart.... that could explain why Global var aren't updated...
=> My goal is to create 2 rectangles that I could manually adjust time by time and EA will reacts from those price level. So I created Global Variables but even if I modify manually the rectangles, Global Var aren't updated?