I have some coding experience but need some help as I don't understand how to incorporate the OnTick() into my ea. Basically, I have bought a tick chart indicator from which I can run offline charts as tick charts with whatever no. of ticks etc.
Below is the code given to me from the vendor to add into my ea, so I added this, changed the start() function to OnTick() function (where all functions work from). Then tried to get action with EA on offline chart. Unfortunately I can get a trade to be placed IF there is a signal exactly on the bar when ea placed, but after more new candles have been painted as per new ticks etc, I don't get any more trades placed even if the conditions are correct. Also, all works fine on standard online charts in tester.
So, to make it obvious, I need help on what do I put in the OnTick() function (keep tick indicator updating information to offline chart, but EA not updating?), and what do i put in the start() function, so EA on offline trades as per signals. As my main function in the past has been start() to run my ea's on offline charts. Also, I can get EA initialised as it trades the first signal if on original bar.
OR, I may have totally overlooked something else which may be limiting the EA from actioning all trades!!
Hope someone has an idea for help, thanks.
Regards, Charles
Code: Select all
//+------------------------------------------------------------------+
//| OnChartEvent function |
//+------------------------------------------------------------------+
void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) // this function gets executed when a chart event happens (http://docs.mql4.com/basis/function/events)
{
if (id==CHARTEVENT_CUSTOM+3758) // this part of code gets executed when RW Tick Chart sends a trigger event to this chart (with ID 3758)
{
OnTick(); // this is a call to the main function (OnTick)
}
}