Gertje plus Squalou plus Forexhard EA

Post Reply
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Re: Gertje plus Squalou plus Forexhard EA

Post by SteveHopwood »

Latest update in post 1. I realised why G++ is not returning to original lot size when a basket is closed.

If you do not use lot incrementing, you do not need the update for now.

Sing out if the fix does not work.

:D
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
acostafulano
Trader
Posts: 243
Joined: Tue Dec 06, 2011 3:40 pm

Re: Gertje plus Squalou plus Forexhard EA

Post by acostafulano »

mantkinth wrote: Note to your understanding of the highlighted line.. it just means if the unrealized profit and loss (upl) >= 0, aka break even or profit, the highlighted line doesnt really matter unless you set the robot to Stop trading after basket closure... effects nothing if you dont manually turn it on and off.

Lastly the only problem with the robot is what people have discovered called the "death trade", but the RangeBoundClosure is the only setting that will get you out... of course when that triggers the hit is substantiale. Need more strategies to get out of those problems early (assuming you leave it unattented... but then again if a basekt if still going for over a week, I think you should take control of it hehe).

What I have been doing to stay out of those "death trades", is set Jumping stop loss to start at like $5, and hey if i get stopped out at BE, im happy, no way to get into a "death trade". (Testing with 0.1 lots here, my Target is set at $50)
Thanks for your reply.

Still, what I'm trying to understand is why the "Stoptrading = true" inputs within the code of LookForBreakEvenAfter if its not being called as a condition to trigger it! Could any coder please enlighten me, at least only for peace of mind? :P



About the "DEATHTRADES"... I agree 100% that these is the system's only flaw but with some kind of early exit logic (paired with its inherent hedging) the strategy would be "deathproof".... That's what I think the LookForBreakEvenAfter input should be in charge of doing, but it seems not to be doing the trick as it is coded right now.

Your approach using Jumping stop from $5 (about 5 pips in your case) makes sense but this could still get you a death trade in an extreme scenario (I'm getting some of this big grids opened with a TP of 10... not so far from that, you see?)
mantkinth
Trader
Posts: 22
Joined: Mon Jan 30, 2012 4:26 am
Location: Sydney, Australia

Re: Gertje plus Squalou plus Forexhard EA

Post by mantkinth »

Indeed even with the Jumping stop of $5 you can still get stuck in a death trade lol
ive been backtesting it on GBPUSD with Dukas tic data with various settings, and it doesnt matter what your settings are... sometimes you will get stuck in a death trade lol, its too bad when you use Empty4 craptester you can't manually exit cause its automatic, then tell it to continue lol

Heck even with a $3 jumping stop, I still get into death trades with different settings.. Also you can't have too many of the grids runnings at once (well depending on your lot size and account size). Like worst cast scenario is having a 3k floating loss or more if you get into a death trade with 0.1 lots and 20 grid size with 10 levels.

I am thinking of making the grid size maybe dynamic instead of fixed (based on ATR or something).. need to have a look on how to do that and see if it helps or anything
magft
Trader
Posts: 195
Joined: Tue Nov 15, 2011 9:59 pm
Location: East Midlands, UK

Re: Gertje plus Squalou plus Forexhard EA

Post by magft »

acostafulano wrote:This is the part of the code that seems to take care of Breaking even (Which in over 2 weeks of testing with different settings and in 16 pairs haven't been able to observe even once; thus my suggestion that it may not be working correctly).

Again, I'm not coder, so I can only TRY to understand what's going on:

//Basket closure at breakeven if LookForBreakevenAfter trades are open
if (OpenTrades > LookForBreakevenAfter)
{
if (MathAbs(OpenBuys - OpenSells) == 1)
{
if (upl >= 0)
{
if (StopTradingAfterBasketClosure) StopTrading = true;
CloseAllTrades();
DeleteRemainingPendingLines();//Remove pending price lines
if (ForceTradeClosure) return;
}//if (upl >= 0)
}//if (MathAbs(OpenBuys - OpenSells == 1)
}//if (MathAbs(OpenBuys - OpenSells) == 1)


If some coder could please correct me:

From what I understand, the "closealltrades()" thingy will only be triggered "if" the "StopTradingAfterBasketClosure and/or "StopTrading" inputs are set to true?

If that's the case, then that's the reason that I'm not getting any closures at breakeven, ever...

Maybe I'm just looking ridiculous trying to understand all of this without knowing mql :S!
That is not exactly correct, i'll try to translate.

//Basket closure at breakeven if LookForBreakevenAfter trades are open
if (OpenTrades > LookForBreakevenAfter) //Number of Open trades more than LookForBreakevenAfter
{
if (MathAbs(OpenBuys - OpenSells) == 1) //if the different between open buys and sells is 1 (buy=2 and sells=3)
{
if (upl >= 0) //we are in some profit
{
if (StopTradingAfterBasketClosure) StopTrading = true; //This is to stop further baskets opening if required so if StopTradingAfterBasketClosure=false wont set
CloseAllTrades(); //So got this far close all trades
DeleteRemainingPendingLines();//Remove pending price lines
if (ForceTradeClosure) return;
}//if (upl >= 0)
}//if (MathAbs(OpenBuys - OpenSells == 1)
}// if (OpenTrades > LookForBreakevenAfter)

So it will only close at BE if we have say 2 buys and 3 sells open,which means more trades than LookForBreakevenAfter=4 and we are in profit.

Hope that helps.

Mike
magft
Trader
Posts: 195
Joined: Tue Nov 15, 2011 9:59 pm
Location: East Midlands, UK

Re: Gertje plus Squalou plus Forexhard EA

Post by magft »

mantkinth wrote:Indeed even with the Jumping stop of $5 you can still get stuck in a death trade lol
ive been backtesting it on GBPUSD with Dukas tic data with various settings, and it doesnt matter what your settings are... sometimes you will get stuck in a death trade lol, its too bad when you use Empty4 craptester you can't manually exit cause its automatic, then tell it to continue lol

Heck even with a $3 jumping stop, I still get into death trades with different settings.. Also you can't have too many of the grids runnings at once (well depending on your lot size and account size). Like worst cast scenario is having a 3k floating loss or more if you get into a death trade with 0.1 lots and 20 grid size with 10 levels.

I am thinking of making the grid size maybe dynamic instead of fixed (based on ATR or something).. need to have a look on how to do that and see if it helps or anything
I have been thinking the same about a dynamic grid size, just need to add a ATR calc in SetUpBuyGrid() and SetUpSellGrid() which would fix it for that basket of trades. Or are you thinking of changing the space between lines during a basket for trades as this would be a lot more tricky.

In the attached pic you can see i have a crappy situation on AUDCHF with 2 buys and 2 sells, when the next trade opens unless the market keeps moving in that dir the basket wont close. Worst case it could go back other way and open another opposite trade. Maybe we should look to minimise loses and close basket if we get stuck with equal number of trades open (say 2 or 3 of each) and back in the CZ, any thoughts?

I am loving this EA though, i've attached my current results for last 7 trading days.

Regards

Mike
You do not have the required permissions to view the files attached to this post.
acostafulano
Trader
Posts: 243
Joined: Tue Dec 06, 2011 3:40 pm

Re: Gertje plus Squalou plus Forexhard EA

Post by acostafulano »

magft wrote:
mantkinth wrote:
In the attached pic you can see i have a crappy situation on AUDCHF with 2 buys and 2 sells, when the next trade opens unless the market keeps moving in that dir the basket wont close. Worst case it could go back other way and open another opposite trade. Maybe we should look to minimise loses and close basket if we get stuck with equal number of trades open (say 2 or 3 of each) and back in the CZ, any thoughts?

I am loving this EA though, i've attached my current results for last 7 trading days.

Regards

Mike

Thanks for the explanation regarding the code. Much appreciated :)

Now, I'm loving the EA so far. It has a good entry, its safe because of its inherent hedging and works very well in picking up the moves because of the grid its based on, but this precise "crappy situations" is what I think we should look to avoid.

I also think that in this "crappy situations" the best thing to do would be just exit (aim for zero profit) and wait for the next CZ and entry and right now the function which aims at that "LookForBReakevenAfter" is not doing the trick (At least not for me).

What you suggest of closing the basket when stuck is precisely what the EA needs, but closing right at the middle of the grid where both the sells and buys are in loss wouldn't be taking the hit at the point of maximum DD for these positions?
acostafulano
Trader
Posts: 243
Joined: Tue Dec 06, 2011 3:40 pm

Re: Gertje plus Squalou plus Forexhard EA

Post by acostafulano »

acostafulano wrote:
magft wrote:
Maybe we should look to minimise loses and close basket if we get stuck with equal number of trades open (say 2 or 3 of each) and back in the CZ, any thoughts?

Mike
What you're saying here can be achieved with Rangeboundtradeclosure. It checks that buys = sells. For example for closure @4 buys and 4 sells you have to set it to 8.
SWG123
Trader
Posts: 565
Joined: Wed Nov 16, 2011 3:02 pm
Location: Cape Town

Re: Gertje plus Squalou plus Forexhard EA

Post by SWG123 »

acostafulano wrote:
acostafulano wrote:
magft wrote:
Maybe we should look to minimise loses and close basket if we get stuck with equal number of trades open (say 2 or 3 of each) and back in the CZ, any thoughts?

Mike
What you're saying here can be achieved with Rangeboundtradeclosure. It checks that buys = sells. For example for closure @4 buys and 4 sells you have to set it to 8.
That will get you out, but you will still take a big loss. We need to scale out elegantly. How about after x longs and x corresponding shorts, and it's starting to hurt, we reverse the grid and hedge the hedges. It then becomes a conventional grid trader until losses are under control?

Will that work? Sounds like it should, but it's too late for me to try the maths. Anybody out there feeling clever?
mantkinth
Trader
Posts: 22
Joined: Mon Jan 30, 2012 4:26 am
Location: Sydney, Australia

Re: Gertje plus Squalou plus Forexhard EA

Post by mantkinth »

Hmm hedge the hedges, but the death trade happens when its properly hedged lol... basically with Gerte when you run out of levels, and each side has the same amount of sells and buys is when your screwed hehe. Your loss will never increase but its a huge loss :o

Basically the worst case scenario can be calculated before starting up the grid.. Also if you reverse the grid, you are just adding to more possible losses, and not to mention the increased margin used.

I dont think there is an automatic way besides takign the loss (which Steve has programmed in already), unless you use your manual trading strategies to try to unbalance the sides and hope you can reduce the losses/or get out (aka martingaling and hoping you pick the right direction). But heck i doubt you can ever program something like into an ea which will do it automatically.

Going back to post 1, this ea can't be fully automated unless you take the hit when it happens.. its semi automatic as you need to save trades lol.

#Think about why the EA was made, and why we using Squalo's indicator... we are trading breakouts and we dont care which direction... problem happens when we have false breaks. If its a true breakout, we can lock in some profit and stop the death trade from ever happening.. its when we can't aka you enter a buy and it goes 1 pip before slamming through the sell level.. which goes for 20 pips, triggering the next level, then going all the way back past the first buy and even further hit the 1st buy level.. and back down to hit level 2 of sell, then back up.. as you add the lots and average down your positions as more levels are open the more you dig yourself into a hole :o
Caillou
Trader
Posts: 48
Joined: Sat Dec 03, 2011 9:11 pm

Re: Gertje plus Squalou plus Forexhard EA

Post by Caillou »

Deleted
Last edited by Caillou on Fri Apr 27, 2012 7:54 am, edited 1 time in total.
Post Reply

Return to “Automated trading systems”