[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 66

 
Once again... int Buy[]; Is it a dynamic array? I mean, it will contain as many elements as I set later?
 
Well, yes... Then how come I can't assign values to an array? I mean, I've already printed everything I can...
 
Good day all! I am quite new to forex, but I still have some experience in the form of a couple of raw Expert Advisors. One of them has shown good (for me) results on the history of 2010, 2011 and 2012. Of course, I have made corrections to the history. The following question has risen. Are there any statistics on the lifetime of TF Day strategies? Can we keep profiting from the strategy without being greedy, by adjusting it (the strategy) to market changes for a long period of time? Who has experience, please give your feedback. I would be very grateful!
 
Dimka-novitsek:
Well, yes... Then how come I can't assign values to an array? I mean, I've already printed everything I can...


Order bookings...
 
Thank you!!!
 
Dimka-novitsek:

I gave an example of a function using a dynamic array (p.64).

dim=ArrayResize(Buy,Raz); - устанавливает размерность Raz для массива Buy. Только после этого можно что-то запомнить в элементе массива с номером Raz-1
 
Thank you! Sorry, didn't pay attention to the function!
 

Help to redo on bar close

Close positions at market price

//| Parameters:|

//| sy - instrument name (" - any symbol,|
//|NULL - current symbol)|
//| op - operation(-1 - any position) |
//|mn - MagicNumber (-1 - any magik)|
//+----------------------------------------------------------------------------+
void ClosePositions(string sy="", int op=0, int mn=-1) {
if(last>=Time[0]) return; // if the bar time has already been checked then exit immediately, i.e.i.e. wait for the new bar
last=Time[0]; //
int i, k=OrdersTotal();

if (sy=="0") sy=Symbol();
for (i=k-1; i>=0; i--) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES) {
if ((OrderSymbol()==sy || sy=="") && (op<0 || OrderType()==op)) {
if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
if (mn<0 || OrderMagicNumber()==mn) ClosePosBySelect();
}
}
}
}
}
 
Macros:

You don't have to rework someone else's functions - Kim has done them well. You just have to use them properly.

How do you know that the bar has already been closed before a new one opens? So, you need to call the function to close the order when the new bar starts to form. How to detect this moment has been shown many times: in the tutorial, in the FAQ and on the forum. Please read something.

 
Sepulca:


Well, first of all, it's quite realistic to cram 6 gigs in ten minutes. You get one print with every tick, what for do you need it?

And secondly, are you sure it's changing?

Some sort of semaphore should be used to print once...

somewhere like this....


thank you guys for the help, but i couldn't figure out what it needs. the loop hangs tight, spits on the conditions, "hangs" the computer and loads gigabytes of logs....

had to amputate!

replaced it with a series of ifs...and put the marks (flags) where needed... ...and it worked. The code just got longer and uglier...

goodbye while function. We'll never meet again!

:))))