Write unrealizad profit and loss when test
-
Hello everyone:
I want to test an EA in mt4 that when opens a trade, write in excel the following: (open price, maximum profit not made, maximum loss not made, closing price)
how can I do? -
There is a block to write information "Write on file". But I used "Comment" for this example: https://fxdreema.com/shared/ooSeSTUHb
-
ok !! I get the Variables max profit and max loss.
but can you tell me if in a trade suppouse I open a buy position at 19.0000 and my SL is when PSAR cross the price.. during the trade the highest profit reached was at 19.20000 but, closes at 18.80000 because the close of the PSAR reversal condition.
so, I want to study my EA in the strategy tester of mt4 writing into an excel file this results to have like this columns:
[trade number][Open Price][close price][high profit unrealized (and it will be the max profit of the variable you create in the example)]
then I can make some changes in the parameters.
I hope I explain my self because I have a poor english

Regards.
ArtPatFX
-
@fxdreema ok !! I get the Variables max profit and max loss.
but can you tell me if in a trade suppouse I open a buy position at 19.0000 and my SL is when PSAR cross the price.. during the trade the highest profit reached was at 19.20000 but, closes at 18.80000 because the close of the PSAR reversal condition.
so, I want to study my EA in the strategy tester of mt4 writing into an excel file this results to have like this columns:
[trade number][Open Price][close price][high profit unrealized (and it will be the max profit of the variable you create in the example)]
then I can make some changes in the parameters.
I hope I explain my self because I have a poor english

Regards.
ArtPatFX
-
I don't understand what you want to do now. You got the max loss and max profit values?

-
Ok, Iยดll try to explain...
I use a PSAR indicator to open and close trades.
on the chart, the first text on red is the open trade condition at 19.02059 and that trade reaches the max profit at 19.16433 but then the price falls and closes at 18.96956 because the closing trade condition.
I want to know if when I backtest my EA on the strategy tester on MT4, the results can be writed in an excel file for each trade with how many profit and loss in pips or money was reached .
like the second image.

I hope it can... and thanks for your time to reply...
Regards
-
But I posted some example above to calculate this max profit. The EA doesn't collect such profits otherwise. I have 2 variables - maxProfit and maxLoss - and they collect the maximum profit and loss as a money amount. The problem is that those are only 2 variables and it will not work if you want to collect the profits from multiple trades at the same time. To do this, arrays of data will need to be used. But if you have only 1 trade at a time, those 2 variables will work good.
