GU H1 high/low entry system?

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.

GU H1 high/low entry system?

Post by SteveHopwood »

It is much simpler than all this and would take me about 30 seconds. I am going out teaching soon but will be back this afternoon, so sing out if you want me to add the relevant code.

:xm:
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.
User avatar
themaxx
Trader
Posts: 71
Joined: Thu May 24, 2012 9:57 am

GU H1 high/low entry system?

Post by themaxx »

SteveHopwood » Fri May 20, 2016 9:24 am wrote:It is much simpler than all this and would take me about 30 seconds. I am going out teaching soon but will be back this afternoon, so sing out if you want me to add the relevant code.

:xm:
Yes please Steve!
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.

GU H1 high/low entry system?

Post by SteveHopwood »

themaxx » Fri May 20, 2016 6:33 pm wrote:
SteveHopwood » Fri May 20, 2016 9:24 am wrote:It is much simpler than all this and would take me about 30 seconds. I am going out teaching soon but will be back this afternoon, so sing out if you want me to add the relevant code.

:xm:
Yes please Steve!
No probs. Sometime this weekend. Don't stop trying to do this stuff for yourself - you will never regret every bit of progress you make, I promise.

:xm:
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.
User avatar
themaxx
Trader
Posts: 71
Joined: Thu May 24, 2012 9:57 am

GU H1 high/low entry system?

Post by themaxx »

Thanks Steve will do
User avatar
woodlands
Trader
Posts: 226
Joined: Sun Mar 23, 2014 6:16 pm

GU H1 high/low entry system?

Post by woodlands »

Thanks Maxx and Steve,
I have tried a different setting for PH, using MPTM for very tight stop and small TP in the hope of low DD and small return, it is interesting so far but very early days so don't know if there is any mileage.
The set files are attached
XAUUSDM15.png
PH test 1.set
PH_MPTM_ test 1.set
You do not have the required permissions to view the files attached to this post.
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.

GU H1 high/low entry system?

Post by SteveHopwood »

V 1c of both versions are in post 2. Here is some explanation to help you develop your own coding skills.

One of the many thingies I have learned from the Proper Coders here is to make code as reusable/adaptable as possible.

The void CloseAllTrades(int type) function starting at line 2577 is a flexible close all function. The parameter int type allows me to tell the function which type of order to close/delete.

Lines 2591-2596 check that the currently selected order 'belongs' to the EA and that it is of the type that needs closing.

OP_BUY is a constant whose value is 0.
OP_SELL is a constant whose value is 1.

So a call such as:
CloseAllTrades(OP_BUY) tells the function to close all buy trades, so the line at 2599
if (OrderType() < 2) closes market trades.

The line at 2612:
if (OrderType() > 1) tells the function to delete pending orders.

I need a way to tell the ea to close/delete everything, so I declare a constant AllTrades at line 23. This call
CloseAllTrades(AllTrades) tells the function to make two passes, closing market trades on the first pass and deleting pendings on the second.

This is why I wrote that you were overcomplicating things; the code already exists for you.

Line 345 declares a boolean, DeletePendingsAfterTradingStops.

Line 5615 opens the void DeleteUnfilledStopOrders(). There is code within the function to deal with a deletion attempt at swap rollover time and your broker disables trading during this period. You might want to adjust your last parameter in the tradingHours input.

Lines 5851-5873 contain two code blocks that work out whether the bot can trade. 5851 contains the call to Balluda's time check function. 5863 deals with the various individual day trading hours - you probably do not use these.

There is a call to DeleteUnfilledStopOrders() in both code blocks.

Ta daa. It took me longer to write this post than it took me to add the code.

:xm:
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.
User avatar
Wavegarrick
Trader
Posts: 1172
Joined: Sun Dec 30, 2012 11:21 am
Location: South Africa

GU H1 high/low entry system?

Post by Wavegarrick »

Ta daa. It took me longer to write this post than it took me to add the code.
:smile:
User avatar
themaxx
Trader
Posts: 71
Joined: Thu May 24, 2012 9:57 am

GU H1 high/low entry system?

Post by themaxx »

This is excellent Steve, thank you very much. Downloading the IDE now so I can follow all of your line references.
SteveHopwood » Sat May 21, 2016 12:03 pm wrote:V 1c of both versions are in post 2. Here is some explanation to help you develop your own coding skills.

One of the many thingies I have learned from the Proper Coders here is to make code as reusable/adaptable as possible.

The void CloseAllTrades(int type) function starting at line 2577 is a flexible close all function. The parameter int type allows me to tell the function which type of order to close/delete.

Lines 2591-2596 check that the currently selected order 'belongs' to the EA and that it is of the type that needs closing.

OP_BUY is a constant whose value is 0.
OP_SELL is a constant whose value is 1.

So a call such as:
CloseAllTrades(OP_BUY) tells the function to close all buy trades, so the line at 2599
if (OrderType() < 2) closes market trades.

The line at 2612:
if (OrderType() > 1) tells the function to delete pending orders.

I need a way to tell the ea to close/delete everything, so I declare a constant AllTrades at line 23. This call
CloseAllTrades(AllTrades) tells the function to make two passes, closing market trades on the first pass and deleting pendings on the second.

This is why I wrote that you were overcomplicating things; the code already exists for you.

Line 345 declares a boolean, DeletePendingsAfterTradingStops.

Line 5615 opens the void DeleteUnfilledStopOrders(). There is code within the function to deal with a deletion attempt at swap rollover time and your broker disables trading during this period. You might want to adjust your last parameter in the tradingHours input.

Lines 5851-5873 contain two code blocks that work out whether the bot can trade. 5851 contains the call to Balluda's time check function. 5863 deals with the various individual day trading hours - you probably do not use these.

There is a call to DeleteUnfilledStopOrders() in both code blocks.

Ta daa. It took me longer to write this post than it took me to add the code.

:xm:
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.

GU H1 high/low entry system?

Post by SteveHopwood »

themaxx » Sat May 21, 2016 1:28 pm wrote:This is excellent Steve, thank you very much. Downloading the IDE now so I can follow all of your line references.
Whilst you are in there, correct one of my copy/paste/forgot-to-edit bloops, spotted by the ever-vigilant Heraclees. :clap: :clap: :clap: :clap: :clap:

Go to line 1782. This code snippet:
price = Ask;
stop = CalculateStopLoss(OP_BUY, price);
take = CalculateTakeProfit(OP_BUY, price);
result = SendSingleTrade(Symbol(), OP_BUY, TradeComment, SendLots, price, stop, take);

needs to be:
price = Bid;
stop = CalculateStopLoss(OP_SELL, price);
take = CalculateTakeProfit(OP_SELL, price);
result = SendSingleTrade(Symbol(), OP_SELL, TradeComment, SendLots, price, stop, take);

I have added the fixes to the files in post 2 without changing the version number.

:xm:
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.
User avatar
themaxx
Trader
Posts: 71
Joined: Thu May 24, 2012 9:57 am

GU H1 high/low entry system?

Post by themaxx »

Excellent work woodlands! You're starting to see the power of this EA!

The EA seems quite dumb when it enters but consider this - if this EA is set to trade when a pair is most active - it will sell the high of the day/ buy the low of the day. If you hold those trades for a few days (and they aren't stopped out), you've caught the high and low of the week, you could catch the high and low of the month, the high and low of the year! And if the pair trended....!!!!!

You don't necessarily need pairs that trend, but you MUST have pairs that make big swings - this EA makes its money when the TP matches the pair's swing. So look for pairs with big swings.

The original rules were designed so that I could trade them manually, and get some sleep. But if you want to trade other pairs, you could change when the EA stops trading (as you don't want to be trading when volatility is low, as you get chewed up).

For example, now the EA is sorted out I'm going to be adding EURJPY and GBPJPY. According to the MATAF.net historical volatility charts, 20-22 GMT are the least volatile times of the day for those pairs - so I will set the EA to sleep during those times.

Also, consider bigger take profit targets. On GU last week I think 200 or 250 pips might have done better.

Keep it up! :good:
woodlands » Sat May 21, 2016 11:42 am wrote:Thanks Maxx and Steve,
I have tried a different setting for PH, using MPTM for very tight stop and small TP in the hope of low DD and small return, it is interesting so far but very early days so don't know if there is any mileage.
The set files are attached




Post Reply

Return to “Automated trading systems”