A complicated problem- Please Help!

HosseinKOGO
160

Hi programmers,
Hope you are having good days.

I have a problem which I can not find my mistake, could you please point me the problem with this?
It would be greatly appreciated if you give me a hand.

#include "TicksInfo.mqh"
CTicksInfo ticksInfo;

input string AllPairsStr = "EURUSD,GBPUSD,NZDUSD";

string AllPairs[];
double ask[101],bid[101];

int tickCount = 0;

////////////////////

int OnInit()
{
StringSplit(AllPairsStr,',',AllPairs);

/*
* Test Printout
*/
for (int i=0; i<ArraySize(AllPairs); i++)
Print ("Currency Pair ", i, " is ", AllPairs[i]);

ticksInfo.init(AllPairs);

return(INIT_SUCCEEDED);
}

/////////////////

void OnDeinit(const int reason)
{
ticksInfo.deInit();
Print ("Total Ticks = ", tickCount);
}

///////////////

void OnTick()
{
ask[0]=Ask;
bid[0]=Bid;

tickCount++;
//Print ("=== Now process tick ", tickCount);
MqlTick myTick;


if (ticksInfo.getTick(_Symbol,myTick)==false)
//printTick (_Symbol,myTick);
//else
Print (_Symbol, " Error");

for(int i=1; i<ArraySize(AllPairs); i++)
{
if (ticksInfo.getTick(AllPairs[i],myTick))
{
//printTick (AllPairs[i],myTick);
ask[i] = myTick.ask;
bid[i] = myTick.bid;
}
else
Print (AllPairs[i], " Error");
}
Comment(ask[0], " , ", ask[1], " , ", ask[2], "\n", bid[0], " , ", bid[1], " , ", bid[2]);

if(Hour()==6)ExpertRemove();
}

///////////////////

/* GLOBAL AREA*/

void printTicktoFile(string sym, MqlTick &tick)
{
int file = FileOpen("LogFile.log",FILE_WRITE|FILE_READ|FILE_TXT);
FileSeek(file,0,SEEK_END);
FileWrite(file, sym, " tick number ", tickCount, ", at ",
tick.time, " ",
IntegerToString(tick.time_msc-(tick.time*1000),3,'0'),
" Ask = ", tick.ask, " Bid = ", tick.bid);
FileClose(file);
}

void printTick(string sym, MqlTick &tick)
{
Print (sym, " tick number ", tickCount, ", at ",
tick.time, " ",
IntegerToString(tick.time_msc-(tick.time*1000),3,'0'),
" Ask = ", tick.ask, " Bid = ", tick.bid);
}


I store Ask/Bid price of each tick for other currencies. Then I run my EA which process based on multi-currencies.
THE PROBLEM is: I only receive the starting price of my ask[1]/bid[1], ask[2]/bid[2] etc. In other words it only catches the price of other currencies at the beginning of date of EA I do backtest and not ask/bid after the first tick of absent currencies.
where should be fixed?

Gyula Szajlai
14
Gyula Szajlai  
HosseinKOGO:

I store Ask/Bid price of each tick for other currencies. Then I run my EA which process based on multi-currencies.

THE PROBLEM is: I only receive the starting price of my ask[1]/bid[1], ask[2]/bid[2] etc. In other words it only catches the price of other currencies at the beginning of date of EA I do backtest and not ask/bid after the first tick of absent currencies.
where should be fixed?

You cannot do multicurrency backtests in MT4.