Can't draw arrow in backtesting ?

 

I just made simple EA but it draws nothing although I use visual mode.

Then I made simple test on init function like this to drew some arrows but nothing showed up.


void init()

{

         ObjectCreate( ChartID(), "Test", OBJ_ARROW_DOWN, 0, Time[1], High[1] ) ;
         ObjectSet("Test", OBJPROP_STYLE, STYLE_SOLID);
         ObjectSet("Test", OBJPROP_ARROWCODE, SYMBOL_ARROWUP);
         ObjectSet("Test", OBJPROP_COLOR, Blue);

}


I'm on the visual mode too...

 

You shouldn't try to access things like High[1] in OnInit() "because during initialization values of information environment parameters may be not ready (information about charts, market prices and so on)"

Check your objects list to see if it has been drawn... just not where you think it should have been. 

 
honest_knave:

You shouldn't try to access things like High[1] in OnInit() "because during initialization values of information environment parameters may be not ready (information about charts, market prices and so on)"

Check your objects list to see if it has been drawn... just not where you think it should have been. 

I've tried it in start function in visual mode but I still got nothing....
 

Your code snippet works fine on Build 765 (Visual Mode or Live Chart).

Have you checked the Objects List?

 

 
honest_knave:

Your code snippet works fine on Build 765 (Visual Mode or Live Chart).

Have you checked the Objects List?

 

Just checked it and there was nothing in the object list, its greyed out.


What should I do now ?

 

I believe you don't attach it properly. Make sure on top right shows your ea name. Sometime you missed it.

I am pretty sure it is common mistake.

 
deysmacro:

I believe you don't attach it properly. Make sure on top right shows your ea name. Sometime you missed it.

I am pretty sure it is common mistake.

Yes, I didn't attach it because I want to test it on back testing in visual mode since this is just a test but the real EA uses graphical objects and I want to see it in back testing visual mode.


But you said it worked in back testing visual mode too right ?

 

There is nothing wrong in principle with the code snippet that you posted.

So the problem must be in how or when that code is implemented.

You'll need to post more code for us to help.

 
mideel: I just made simple EA but it draws nothing although I use visual mode.
void init(){
         ObjectCreate( ChartID(), "Test", OBJ_ARROW_DOWN, 0, Time[1], High[1] ) ;
         ObjectSet("Test", OBJPROP_STYLE, STYLE_SOLID);
         ObjectSet("Test", OBJPROP_ARROWCODE, SYMBOL_ARROWUP);
         ObjectSet("Test", OBJPROP_COLOR, Blue);
}

  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. There is no chart to draw on in init. Time[] and High[] may not exist. Put the code in start. An EA must have a start.
  3. Check the logs - was the EA actually attached?
  4. Check your return codes (ObjectCreate) What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
 

Are you guys really sure it works in back testing ?


Its true that it works if I really attach the EA to the chart, but still in back testing visual mode, it showed nothing... I have made sure there is no error like no tick data, I use daily time frame and 2 day length of back testing.


And to make sure, there is no misunderstanding... visual mode back testing means I don't attach the EA to the chart right ?

 
mideel:

Are you guys really sure it works in back testing ?


Its true that it works if I really attach the EA to the chart, but still in back testing visual mode, it showed nothing... I have made sure there is no error like no tick data, I use daily time frame and 2 day length of back testing.


And to make sure, there is no misunderstanding... visual mode back testing means I don't attach the EA to the chart right ?

Does the code delete the objects on de-initialization?

If so, 2 days testing on the daily time-frame would  delete the object quicker than you are able to see it.

Reason: