How to let an EA (not indicator) draw lines in back test?

 

I have an indicator that draws a line with a logic that starts from [n] bars back and changes the value bit by bit until it reaches the right end of the chart. (as per my last post https://www.mql5.com/en/forum/382876)

it works marvelously and I am moving to backtest albeit with a problem. Since the indicator counts from some [n] bars back from the "current" bar, and the backtester doesn't show any data before the start date (even if I have data from 2003/5/23 from dukascopy, starting from 2004/1/1 there's nothing before), I don't suppose the indicator will start properly at the very start. Perhaps there are work arounds like starting the indicator halfway but I want to spare myself the hassle and base all calculations in the EA.

So, I want to see the line that changes gradually on the way, it would work something like how with indicator line buffers I can designate some value to each bar position, the EA can supply new values every new bar. The purpose is to see how well the EA is performing and if there are any problems, with the help of the MT4 backtester visual chart.

I browsed the OBJ_something types and I don't see anything that could do. How do I draw such line with an EA in the MT4 backtester?

Thank you my dudes.


Edit: seems like there's a way to draw OBJ trend lines that isn't infinitely long, trying that out. (https://www.mql5.com/en/forum/153455) With this function perhaps I can just create a small line segment on every new bar, my line was not very smooth anyways.

P.S. since only MT5 has ray_left parameter for this object, I can't stop it from being infinitely long on the left side. 

Edit2: turns out after I stop the EA in visual mode, and switch on the indicator, it works fine and can access HST data before the start date. So for checking purposes it's fine to just use the indicator.

Indicator Coding Question: Is it possible to get the index for the newest candle when the indicator started?
Indicator Coding Question: Is it possible to get the index for the newest candle when the indicator started?
  • 2021.11.27
  • www.mql5.com
I am trying to write an indicator that calculates some cumulative change over time...
 

A quick google search for similar questions seems to suggest there is no solution to this. currently planning on just drawing a fu** ton of buy sell arrows.

If MT5 or some other program lets me do that please tell me lol.

Or of course if there is a way to do this.

 
Kelvin Nelson #:

A quick google search for similar questions seems to suggest there is no solution to this. currently planning on just drawing a fu** ton of buy sell arrows.

If MT5 or some other program lets me do that please tell me lol.

Or of course if there is a way to do this.

To do this you are going to have to save your information to a csv file and when the time comes get the data possibly with the new bar and then draw lines or boxes with that data if you will need a forward date to do that parse the date and create a new one. 

That is what I have done.  If it can be done in another way idk just break it down into simple functions then begin merging them together to get the outcome your looking for.