Flag Counter help.
I suggest you to go through your program with the debugger to find in what situation it doesn't what you want it to do..
Carl Schreiber:
I suggest you to go through your program with the debugger to find in what situation it doesn't what you want it to do..
I suggest you to go through your program with the debugger to find in what situation it doesn't what you want it to do..
Hi Carl,
I believe it is the flagging problem.
The rest of the code is just simple Open order function. no complex logic.
tried to use while function.
Test Result:
- if Daily profit >=0, uselot = StandardLot;
- else if Daily profit <0, uselot = StandardLot*Multiply_2; <---- it skip StandardLot*Multiply_1. It should run StandardLot*Multiply_1 first.
- any idea where did I do wrong?
double LotSequence() { double uselot = 0; int counter = 0; // Initial flag double StandardLot = 0.10; int Multiply_1 = 2, Multiply_2 = 5; if(DailyProfit()>=0) // Positive Daily Profit { counter=0; uselot = StandardLot; } else { while (counter<=2) { if(counter==1) uselot = StandardLot*Multiply_1; if(counter==2) uselot = StandardLot*Multiply_2; counter++; } } return(uselot); }
fellow programmers,
need help on reset the flag for LotSequence counter as below.
Test result: Lot open StandardLot without multiplying even in Negative Daily profit.
Any idea where did I miss?