My shell EA code

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: My shell EA code

Post by SteveHopwood »

Latest versions of the shells are in post 1.

There is some general code-tightening.

I have adapted some of the functions so that they are more easily used in multi-pair ea's.

Something came up this week when I coded an ea for one of our members. When an ea created using one of these shells calculates sl/tp, it does so based on the market at the time. If there is some slippage when the trade is actually sent (and when isn't there?) then the sl/tp will be off by the value of the slippage.

Ok, so this does not matter a lot when the sl/tp are hundreds of pips away, but a tad crucial in a 5 pip scalper. I have added code to check that the sl/tp are exact once the trade has returned to the platform from the crim's server.

: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.
Profitiser
Posts: 2
Joined: Tue Jun 12, 2012 4:55 pm

Re: My shell EA code

Post by Profitiser »

Hi Steve,
there seems to be a bug in your "Shell auto trading robot code by Steve Hopwood".
The function "ModifyOrder" should be changed to:

void ModifyOrder(int ticket, double stop, double take){
...
for (int cc = 0; cc < RetryCount; cc++){

// delete: for (int d = 0; (d < RetryCount) && IsTradeContextBusy(); d++) Sleep(100);

if (take > 0 && stop > 0) {
while(IsTradeContextBusy()) Sleep(100);
if (OrderModify(ticket, OrderOpenPrice(), stop, take, OrderExpiration(), CLR_NONE))
return;
}//if (take > 0 && stop > 0)

if (take != 0 && stop == 0)
{
while(IsTradeContextBusy()) Sleep(100);
if (OrderModify(ticket, OrderOpenPrice(), OrderStopLoss(), take, OrderExpiration(), CLR_NONE)) return;
}//if (take == 0 && stop != 0)

if (take == 0 && stop != 0)
{
while(IsTradeContextBusy()) Sleep(100);
if (OrderModify(ticket, OrderOpenPrice(), stop, OrderTakeProfit(), OrderExpiration(), CLR_NONE)) return;
}//if (take == 0 && stop != 0)
}//for (int cc = 0; cc < RetryCount; cc++)
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: My shell EA code

Post by SteveHopwood »

Are you insane?

Are you seriously suggesting that code provided by one of the best and most respected coders on the planet, and that has been used thousands of times in as many ea's and scripts' has a bug?

Jesus wept buckets of blood. Again.

Get a grip fella, and go back to silently lurking. Leave the coding to the Big Boys - it is what I do when they get involved. They have forgotten more about this stuff than you or I will ever know.

And learn to read the damn comments in my code. Doing so here would have saved you from my wrath.
Profitiser wrote:Hi Steve,
there seems to be a bug in your "Shell auto trading robot code by Steve Hopwood".
The function "ModifyOrder" should be changed to:

void ModifyOrder(int ticket, double stop, double take){
...
for (int cc = 0; cc < RetryCount; cc++){

// delete: for (int d = 0; (d < RetryCount) && IsTradeContextBusy(); d++) Sleep(100);

if (take > 0 && stop > 0) {
while(IsTradeContextBusy()) Sleep(100);
if (OrderModify(ticket, OrderOpenPrice(), stop, take, OrderExpiration(), CLR_NONE))
return;
}//if (take > 0 && stop > 0)

if (take != 0 && stop == 0)
{
while(IsTradeContextBusy()) Sleep(100);
if (OrderModify(ticket, OrderOpenPrice(), OrderStopLoss(), take, OrderExpiration(), CLR_NONE)) return;
}//if (take == 0 && stop != 0)

if (take == 0 && stop != 0)
{
while(IsTradeContextBusy()) Sleep(100);
if (OrderModify(ticket, OrderOpenPrice(), stop, OrderTakeProfit(), OrderExpiration(), CLR_NONE)) return;
}//if (take == 0 && stop != 0)
}//for (int cc = 0; cc < RetryCount; cc++)
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
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: My shell EA code

Post by SteveHopwood »

Latest version of Bare Bones in post 1:
  • added Bob's H4 240 moving average filter.
  • added and enhanced the average spread calculation from RRTnP.
  • extended CalculateStopLoss/TakeProfit functions to make them more flexible. This also allows CheckTpSlAreCorrect() to work when stops are calculated in ways that do not include StopLoss.
  • re-ordered the calls to CalculateStopLoss/TakeProfit in LookForTradingOpportunities so that the tp in risk:reward calculations can be more easily made.
I am not absolutely certain that these changes are watertight. Bloops will emerge with usage.

: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.
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: My shell EA code

Post by SteveHopwood »

I have added code to call Bob's 10.5 CSS indi. Details in '10.5 CSS' in post 1.

Also updated the user guides in the zip file.

: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.
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: My shell EA code

Post by SteveHopwood »

Latest version of Bare Bones in post 1, fixing the bugs that have emerged in the Bob And Shelley Again thread.

: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.
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: My shell EA code

Post by SteveHopwood »

Latest version of Bare Bones in post 1 - I have added Paul's Lib.CSS code to it.

It is not much of a bare bones anymore, but does contain the stuff that I automatically add to all the EA's I code so the user has the choice of using them or not.

: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.
ibrual
Posts: 2
Joined: Fri Sep 13, 2013 3:48 am

Re: My shell EA code

Post by ibrual »

i have been trying to write codes on price actions like tops, bottoms, doji, marubozu but dont know where to start. any ideas?
dietcoke
Trader
Posts: 162
Joined: Tue Nov 15, 2011 9:59 pm

Re: My shell EA code

Post by dietcoke »

ibrual wrote:i have been trying to write codes on price actions like tops, bottoms, doji, marubozu but dont know where to start. any ideas?
Wrong place to put this question really. But since you ask, try a google search for "MQ4 candle patterns"

You should get links to some pattern indicators.

there ia also a big thread on Forx TSD

http://www.forex-tsd.com/harmonic-tradi ... ading.html
Image
ibrual
Posts: 2
Joined: Fri Sep 13, 2013 3:48 am

Re: My shell EA code

Post by ibrual »

Ok dietcoke, thanks.
Post Reply

Return to “Coders Hangout”