Profitable Hedging Lots Strategy

 

Hi,

i'm new in this forum.. from Germany and ask for someone help me in coding please.. attached is a very good hedging system that's very profitable for me.. But I need some adjustments.. First the ea has a start and end hour function, but it if you choose this function it takes only one trade.. f. e. if you set 15 till 19 GMT it makes only one trade at 15 and then ends trading.. I don't know why.. please help..

And second if you try this ea you will attract attention that the SL and the TP on the actual trade and the stop/sell type is not the same, but it should be the same.. at the moment I adjust the stop target levels manually.. I hope you understand this pleas help me.. my settings are:

Lots: 0.1

StopDistance: 20.0

TakeProfit: 15.0

StopLoss: 30.0

many thanks in advice

 

I have added a parameter called FiveDigitBroker that seemed to have fixed the problem.

The potential of this EA is impressive but drawdowns not so much. I was only able to backtest it for some period if I start with 0.01 lot. Starting from 0.1 would blow up the account immediately.

Regards,

Riz

Files:
 

Sl/tp

Hi syedrizwan,

first thank you for your 5-digit-parameter.. very good.. the potential of this ea is really really impressive.. I'm live on alpari with 0.01 lots.. but I think the ea sets wrong sl/tp's.. f.e. on alpari I have a spread on eur/usd 1.8 pips.. so first trade:

sell 0.01 1.42166 S/L 1.42484 T/P 1.42024 and

stop buy 0.03 1.42346 S/L 1.42046 T/P 1.42506

here you see the difference between SL and TP is 2.2 pips, so it can happen that sell order hits sl but the stop buy order not touch the t/p from the already opened stop buy order and that is wrong.. I hope you understand the problem.. my english is not so well maybe you or someone else can fix this problem..

kind regards

 

SL and TP calculations

for the sell order the SL gap is exactly 31.8 pips which is actually 30 pip stop loss + 1.8 pips spread and TP gap is exactly 14.2 which is actually 15 pips TP and - 1.8 pips spread.

I guess the only thing wrong with the calculations is that this EA is calculating both SL and TP using Ask for a sell order and similarly using Bid for the Buy order

Whereas, in my understanding, it should be calculating SL using Ask, and TP using Bid so the spread is accounted for, for a sell order. Similary for Buy order it should be changed accordingly.

If you confirm the above I can make these changes for you.

Regards,

Riz

 

Paulo_Costa_Hedge.mq4 EA

Dear Syed, I tested the ea and yes it closes the po (same pair) once the open position hit TP but leave the other open position (same pair) as it is. Can you please check to enable all other open positions (profit/loss) also closed together with the one that hit the TP this may reduce the loses. Thanks

 

Dear Syed, I tested the ea and yes it closes the po (same pair) once the open position hit TP but leave the other open position (same pair) as it is. Can you please check to enable all other open positions (profit/loss) also closed together with the one that hit the TP this may reduce the loses. In other way, the ea shall close all orders in the same pair once positive profit as set, this will eliminate the losses. Thanks

 

should it close all orders or should it close all orders only if the total sum is in profit?

Right now the EA opens and closes positions according to the direction of the moving average.

Having said that I havent seen this EA actually closing the order itself, all of them seem to be either t/p or s/l.

Regards,

Riz

 
syedrizwan:
for the sell order the SL gap is exactly 31.8 pips which is actually 30 pip stop loss + 1.8 pips spread and TP gap is exactly 14.2 which is actually 15 pips TP and - 1.8 pips spread.

I guess the only thing wrong with the calculations is that this EA is calculating both SL and TP using Ask for a sell order and similarly using Bid for the Buy order

Whereas, in my understanding, it should be calculating SL using Ask, and TP using Bid so the spread is accounted for, for a sell order. Similary for Buy order it should be changed accordingly.

If you confirm the above I can make these changes for you.

Regards,

Riz

YES you're right it's using Ask for a sell order and Bid for the Buy order.. many thanks for changing this

 

Just a re-confirmation before I post the EA:

for Buy Order SL = Ask - SLPips and TP = Bid + TPPips

for Sell Order SL = Bid + SLPips and TP = Ask - TPPips

Above is the change which I will make. Appologies for being dumb (its a professional requirement as a programmer (never assume anything) )

Regards,

Riz

 

re-confirmation

hey riz,

confirmed and many many thanks

 

Account for the spread

Hi FxFux,

You have presented an interesting concept - thank you.

In giving it some thought on the EUR/USD tonight (AEST time), I noticed that in my particular test case I was long from 1.4166. The price dropped to Sell 1 @1.4106 where the SL was triggered, but the price failed to drop enough to cover the spread to reach my buy stop (Buy 3 @1.4106). This meant that the stop loss was triggered - play money gone, but I was not in the 'recovery trade' because of the spread.

I dont know if this makes sense??? I guess it was very unlucky that the price turned right at that point, but still a real possibility.

Anyway, I'll keep playing with it - thanks again.

Cheers,

mperry

Reason: