You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello,
I am quite new to coding and having quite a lot of fun setting myself tasks to become better - this one however I can't seem to get my head around
Basically, I am trying to increment the array size in the CopyTicks function until the condition of its .last price is lower than my test price.last is met.
I am using ticks[0].last as my starting point and when my tick.last finally reaches my test price the loop bugs out which is fine, but until that point i would like to be adding data to the array but the array size always returns 6
I think I am on the right path but could do with a pointer in the right direction to make it work
Thank you :)
PTT
{
double testNumber = 1.05245; //this is a test random price i know is lower than the value at ticks[0].last
MqlTick tick;
double last=0;
if(SymbolInfoTick(_Symbol,tick))
last=tick.last;
double arraySize = 6; // setting the starting value for the array size in the CopyTicks function
MqlTick ticks[]; // a dynamic array
int copied=CopyTicks(_Symbol,ticks,COPY_TICKS_TRADE,0,(int)arraySize);
for(int i=(int)arraySize;testNumber<ticks[0].last;i++){
Print(ticks[0].last);
int size=ArraySize(ticks);
Print(size); //always prints as 6 and not incrementally higher
Sleep(5000);
}
}