milanese » Tue Feb 23, 2016 4:54 pm wrote:
I don't see your point sorry, you can let the HPEA set pendings in both directions with the existing versions, or let an opposide order kill when the other one is filled..
Best is, you check this EA with different settings on demo out, to getting familiar with it's potent functions..
Cheers
Tommaso
Dear Tommaso,
Sorry for not being clear so let me reformule if you don't mind.

My use of HPEA set pending in both directions is more for hedging strategy once my wished pending order is filled. First I let HPEA set auto pending order in one direction(for example pending buy stop), price can go down so HPEA will "movePendingBuyDownIfPriceMovesDown". I don't want HPEA set pending in both directions at sight because sometimes price can trigger the opposite wished pending order before getting on my favour so i lost the advantage of my trading plan

On another hand, once my wished order triggered, HPEA can set stacking pending orders and opposite pending order for hedging with "FixedDistanceOppositePips". So I can manage like what
FxFoil mentionned
At Present, with my 2 cents coding skills (never code before

) I made 2 instances of HPEA (1 for autoBuy and 1 for Auto Sell), for each I've just removed 1 condition on each :
Code: Select all
if(movePendingSellUpIfPriceMovesUp)// && SetAutoPendingStopSell)
or
if(movePendingBuyDownIfPriceMovesDown) //&& SetAutoPendingStopBuy)
Then HPEA works like I describe above. It set 1 pending order 1 one direction, once filled set both pendings. But I not sure to measure de consequences so I still testing it or if you can update with correct code
Secondly, I was thinking to request if it's "FixedDistanceOppositePips" could be calculate with ATR.
However, I was reading within the code and find easy to understand for my simple mind so I add it my self.
Could you please correct if It's wrong ?
Code: Select all
extern bool FixedDistanceToOpposite=true;
extern bool useATRForFixedDistanceToOpposite=true;
extern ENUM_TIMEFRAMES atrDistanceToOppositeTF=PERIOD_H4;
extern double atrMultiplicatorDistanceToOpposite=0.8;
extern int atrPeriodDistanceToOpposite=14;
And function declaration :
Code: Select all
if(useATRForFixedDistanceToOpposite==true)
{
adr=GetAtr(Symbol(),atrDistanceToOppositeTF,atrPeriodDistanceToOpposite,0);
if(CloseEnough(adr,0))adr=MathAbs(iHigh(OrderSymbol(),PERIOD_W1,1)-iLow(OrderSymbol(),PERIOD_W1,1));
FixedDistanceOppositePips=NormalizeDouble((atrMultiplicatorDistanceToOpposite*adr*factor),0);
}
Thank you for your feedback,
Hai