Close in profit in multi stategy EA
5 replies
Peaceprofits
6 years ago #116774
Hello all…..
please advise…
I am developing a strategy where 4 different strategies (2 long and 2 short) are all working in one EA…. All these strategies are independant of each other, with different magic numbers….. No stop Loss but hegding
As an example the two long strategies go into drawdown as the market falls and obviously the short strategies continue trading against the floating drawdown from the making profit against the drawdown and adding…….
So through the Shorts continuing to trade against the floating drawdown, How do I CLOSE ALL positions when The Account balance exceeds, is greater by 100pips than the floating loss
For example an account Balance £1500 and P&L $-400 I close ALL Positions leaving a Total Account Balance $1100.
But lets say the floating Loss is at $700 I do not want to exit or close positions but wait until it reaches $400
Eamon
gentmat
6 years ago #142894
Hello all…..
please advise…
I am developing a strategy where 4 different strategies (2 long and 2 short) are all working in one EA…. All these strategies are independant of each other, with different magic numbers….. No stop Loss but hegding
As an example the two long strategies go into drawdown as the market falls and obviously the short strategies continue trading against the floating drawdown from the making profit against the drawdown and adding…….
So through the Shorts continuing to trade against the floating drawdown, How do I CLOSE ALL positions when The Account balance exceeds, is greater by 100pips than the floating loss
For example an account Balance £1500 and P&L $-400 I close ALL Positions leaving a Total Account Balance $1100.
But lets say the floating Loss is at $700 I do not want to exit or close positions but wait until it reaches $400
Eamon
you make a variable lets call it “amountexeed”
you make another variable of type bool lets call it y “isexceedamount”
you make another variable call it amountrecovered
On tick if amountProfit() <= amountexceed (-700$ or -200pips)
{
isexceedamount=true
}
now still in ontick function
another function is called
if(isamountexceed == true && (amountProfit amountexceed)){
closeallpositions();
}
thats a pseudocode use it and type such logic
Sent from my iPhone using Tapatalk
Peaceprofits
6 years ago #142940
Thank you Gentmat,
I understand how to make variables in EA wizard, but I’m do not understand ontick function
When you say “ontick function” are you talking about Costum coding in EA wizard?
gentmat
6 years ago #142941
Thank you Gentmat,
I understand how to make variables in EA wizard, but I’m do not understand ontick function
When you say “ontick function” are you talking about Costum coding in EA wizard?
yes dont bother with ontick . the wizard code inside it.
Sent from my iPhone using Tapatalk
Peaceprofits
6 years ago #143001
So is costum code needed to do this in EA wizard, or can this be done by simply setting the rules and conditions in EA wizard?
tomas262
6 years ago #143189
Hello,
just setup rules as mentioned on a Wizard tab. By default conditions in Wizard are evaluated on each tick (do not check “evaluate rule on bar open …..”)
Viewing 5 replies - 1 through 5 (of 5 total)