Local variable to retain its value.
From where this code is run ? (from which event handle). What is the initial value of volume and where it is in the code ?
Beside that, you should not rely that the last deal by index is the last deal out.
I don't need any info, I'm trying to make you think about your code.
What are you thinking this code is doing ?
There is no reason to delete it and if you have an answer you should provide it.
A forum is not a place to get personal help and then delete it, it's a place to share.
I modified only this:
if(lastDealProfit < 0) { if(lastdealticket != historyDealTicket) // in where the lastdealticket is a static variable { volume = volume * RR; lastdealticket = historyDealTicket; }
Hello.
There is a simple code. The idea is next, trading volume will increase after there was a losing trade to recover losses.
What I am trying to do is that if for example trading volume was 0.01 and there was a loss trade, it becomes 0.02 and resets once there is a winning trade.
The problem is that instead of 0.01, 0.02, 0.04, 0.08, etc. after a series of loss trades, it just stays at 0.02. its value changes only once.
Can someone explain how to retain the changed value?