For example, below are my trades
Trade 1: -100$ (lose) => loss_count = 1, loss_amount = -100 // Identify the first loss and assign it into loss_amount var
Trade 2: -200$ (lose) => loss_count = 2, loss_amount = -300 // 2nd loss, negative profit will be cumulate loss_amount++
Trade 3: +100$ (win) => loss_count = 3, loss_amount = -200 // a win won't be counted as reset as long as the loss_amount still negative
Trade 4: +500$ (win) => loss_count = 0, loss_amount = 0 //reset to 0
So how do I make this in MQL5?
I wrote this one based on MQL5 reference, so I must have messed up something. Though there is no error in the code, but it didn't return correct value when it was running
You can just apply it into your chart, and open a random market trade and close immediately to test it
Before asking people to run your code and invest their time, please consider providing all the relevant information.
What it returned ? What are you expecting it should have returned ? and how do you come to this conclusion ?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
For example, below are my trades
Trade 1: -100$ (lose) => loss_count = 1, loss_amount = -100 // Identify the first loss and assign it into loss_amount var
Trade 2: -200$ (lose) => loss_count = 2, loss_amount = -300 // 2nd loss, negative profit will be cumulate loss_amount++
Trade 3: +100$ (win) => loss_count = 3, loss_amount = -200 // a win won't be counted as reset as long as the loss_amount still negative
Trade 4: +500$ (win) => loss_count = 0, loss_amount = 0 //reset to 0
So how do I make this in MQL5?
I wrote this one based on MQL5 reference, so I must have messed up something. Though there is no error in the code, but it didn't return correct value when it was running
You can just apply it into your chart, and open a random market trade and close immediately to test it