You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Are you testing your code in the Strategy Tester ?
Yes,
Today I will insert the code in EA and see if it runs!
I'm not so sure about the results of this part of the code:
Because it can happens 0 < Shift < 1 and the profit > Protection_Level !!
.
Yes,
Today I will insert the code in EA and see if it runs!
I'm not so sure about the results of this part of the code:
Because it can happens 0 < Shift < 1 and the profit > Protection_Level !!
.
Or you could just do this . . .
I've no time to test it because I've got to sleep!!!
You will get an error doing this . . . .
double Max_Profit_Short
. . . too many times.
What happens if your OrderModfy() fails ? don't you want to know that it has failed ?
Read this: What are Function return values ? How do I use them ?
I need to protect the gains on my EA. I was wondering about something that puts the stop in the break when LEVEL_PROTECT is achieved.
The hard way (for me) is to know the MAX and MIN profit of the current orders by it magic number.
. As you see strutch we all want to help you
if you also show you trie to learn and tell us what you want and to get it and show us what you tried
We know now that you work with an EA and you have inside that EA for sell and buy different magicnumber
My idea (maybe i'm wrong in what you want)
To protect the gain of your EA you have to know what the profit is.... i think you can work with total profit all open trades your EA
When total profit becomes>=0 when all trades are calculated you will have at that price a breakeven point where your protection level can start if the gain is in profit
XXX pips from that (protection) level in right direction you can go trail this level If the price comes back to that protection level close all trades
Keep also in mind If the EA opens a new trade then the total breakeven is not the same so count total trades of your EA
I think also about total lots buy EA total lots sell EA
If TotalProfit >0 and total lots buy > total lots sell then protection level has to move up with more profit
If TotalProfit >0 and total lots buy < total lots sell then protection level has to move down with more profit
This is how I look to your problem.... at this moment
.
I realy would like to use different MagicNumbers for buy and sell orders in this EA to analyse it separatly in MyForexBook.
I think for that I've got only to duplicate your (SO MUCH SIMPLE!!!) function...
Thank you RaptorUK! With this code I'm almost where I never get alone!!! :)
PS - About the "securiy system" you talk... I'm thinking doing that when I finish the write of EA.. One step at a time!! :P
.
.
I think it's done the calculation of max profit of each order... :)
thank you so much for the help!
I tried your formulas but failed to get the highest floating profit value as if the trade’s profit dropped, it can’t keep the highest floating profit value. I modified the formulas a little bit as follows :-
Kindly have a look where does it go wrong, thank you.
Because you don't remember anything. *MxPft are not global or static. They are set to the current highest.
Because you don't remember anything. *MxPft are not global or static. They are set to the current highest.
Hi William, thanks. I've no programming background, hope you don't mind, could you please write down your codes how to set the MxPft to be global or static and able to refresh the max floating profit value to zero if the trade is closed ? Thanks.