Gday: a D1 Stochastic OB/OS trading robot

Locked
User avatar
gaheitman
Trader
Posts: 655
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Re: Gday: a D1 Stochastic OB/OS trading robot

Post by gaheitman »

SteveM wrote:
SteveHopwood wrote: The code should force the ea to keep trying to send the trade. Anyone spotting a flaw here, please sing out.
I'm new to Empty4 and a long time since I coded so I could very easily be way off

This is in the send single trade function, inside a for(;;) loop

Code: Select all

         Print(Symbol(), " ", WindowExpertName(), " ", stype," order send failed with error(",err,"): ",ErrorDescription(err));
         return(false);
Won't the "return (false)" part exit the function completely rather than go through the loop again?
You are correct, the return (false) skips the retry logic within SendSingleTrade() (and should be fixed), but outside of that loop in LookForTradingOpportunities(), if SendSingleTrade() returns false, it resets the bar count and tries again on the next tick.

We should probably differentiate between temporary and permanent errors and only retry on temporary ones.

From stderror.mqh:

Code: Select all

#define ERR_NO_ERROR                                  0
#define ERR_NO_RESULT                                 1
#define ERR_COMMON_ERROR                              2
#define ERR_INVALID_TRADE_PARAMETERS                  3
#define ERR_SERVER_BUSY                               4
#define ERR_OLD_VERSION                               5
#define ERR_NO_CONNECTION                             6
#define ERR_NOT_ENOUGH_RIGHTS                         7
#define ERR_TOO_FREQUENT_REQUESTS                     8
#define ERR_MALFUNCTIONAL_TRADE                       9
#define ERR_ACCOUNT_DISABLED                         64
#define ERR_INVALID_ACCOUNT                          65
#define ERR_TRADE_TIMEOUT                           128
#define ERR_INVALID_PRICE                           129
#define ERR_INVALID_STOPS                           130
#define ERR_INVALID_TRADE_VOLUME                    131
#define ERR_MARKET_CLOSED                           132
#define ERR_TRADE_DISABLED                          133
#define ERR_NOT_ENOUGH_MONEY                        134
#define ERR_PRICE_CHANGED                           135
#define ERR_OFF_QUOTES                              136
#define ERR_BROKER_BUSY                             137
#define ERR_REQUOTE                                 138
#define ERR_ORDER_LOCKED                            139
#define ERR_LONG_POSITIONS_ONLY_ALLOWED             140
#define ERR_TOO_MANY_REQUESTS                       141
#define ERR_TRADE_MODIFY_DENIED                     145
#define ERR_TRADE_CONTEXT_BUSY                      146
#define ERR_TRADE_EXPIRATION_DENIED                 147
#define ERR_TRADE_TOO_MANY_ORDERS                   148
#define ERR_TRADE_HEDGE_PROHIBITED                  149
#define ERR_TRADE_PROHIBITED_BY_FIFO                150
I would suggest we stop trying (and maybe stop the ea) if we get the following errors:

Code: Select all

#define ERR_COMMON_ERROR                              2
#define ERR_INVALID_TRADE_PARAMETERS                  3
#define ERR_OLD_VERSION                               5
#define ERR_NO_CONNECTION                             6
#define ERR_NOT_ENOUGH_RIGHTS                         7
#define ERR_TOO_FREQUENT_REQUESTS                     8
#define ERR_MALFUNCTIONAL_TRADE                       9
#define ERR_ACCOUNT_DISABLED                         64
#define ERR_INVALID_ACCOUNT                          65
#define ERR_INVALID_TRADE_VOLUME                    131
#define ERR_MARKET_CLOSED                           132
#define ERR_TRADE_DISABLED                          133
#define ERR_NOT_ENOUGH_MONEY                        134
#define ERR_ORDER_LOCKED                            139
#define ERR_LONG_POSITIONS_ONLY_ALLOWED             140
#define ERR_TOO_MANY_REQUESTS                       141
#define ERR_TRADE_MODIFY_DENIED                     145
#define ERR_TRADE_EXPIRATION_DENIED                 147
#define ERR_TRADE_TOO_MANY_ORDERS                   148
#define ERR_TRADE_HEDGE_PROHIBITED                  149
#define ERR_TRADE_PROHIBITED_BY_FIFO                150
And for these, I suggest a call to RefreshRates() and try again.

Code: Select all

#define ERR_INVALID_PRICE                           129
#define ERR_INVALID_STOPS                           130
#define ERR_PRICE_CHANGED                           135
#define ERR_OFF_QUOTES                              136
#define ERR_BROKER_BUSY                             137
#define ERR_REQUOTE                                 138
#define ERR_TRADE_CONTEXT_BUSY                      146
So, perhaps the return(false) line in SendSingleTrade() could be replace with:

Code: Select all

//check for temporary errors
if (err != ERR_NO_ERROR  &&
    err != ERR_NO_RESULT &&
    err != ERR_INVALID_STOPS && 
    err != ERR_PRICE_CHANGED &&
    err != ERR_OFF_QUOTES &&
    err != ERR_BROKER_BUSY &&
    err != ERR_REQUOTE &&
    err != ERR_TRADE_CONTEXT_BUSY)
   return(false);
I think we should collectively review the list of errors and come up with a standard procedure to evaluate error numbers an react accordingly. For example, I get the err_common_error when my data feed is messed up. I don't think I'd want to keep trading if I get a drop in connectivity, since missing bars will "break" most systems.

George
markft
Trader
Posts: 82
Joined: Thu Dec 08, 2011 12:06 pm
Location: Sydney, Australia

Re: Gday: a D1 Stochastic OB/OS trading robot

Post by markft »

We can also change the call to OrderSend to use a replacement "safe" version such as the one in liborderreliable or 7bit's version. These retry for temporary errors and give up for permanent errors... Just my 2 cents
User avatar
gaheitman
Trader
Posts: 655
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Re: Gday: a D1 Stochastic OB/OS trading robot

Post by gaheitman »

markft wrote:We can also change the call to OrderSend to use a replacement "safe" version such as the one in liborderreliable or 7bit's version. These retry for temporary errors and give up for permanent errors... Just my 2 cents
I'm not familiar with the first library you mention, but I believe 7bit's is GPL. Steve would have to be willing to accept that yoke before we included it in the shell.

George
markft
Trader
Posts: 82
Joined: Thu Dec 08, 2011 12:06 pm
Location: Sydney, Australia

Re: Gday: a D1 Stochastic OB/OS trading robot

Post by markft »

True, it might not be possible due to licencing. The first libray is GPLed as well.
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: Gday: a D1 Stochastic OB/OS trading robot

Post by SteveHopwood »

gaheitman wrote:
markft wrote:We can also change the call to OrderSend to use a replacement "safe" version such as the one in liborderreliable or 7bit's version. These retry for temporary errors and give up for permanent errors... Just my 2 cents
I'm not familiar with the first library you mention, but I believe 7bit's is GPL. Steve would have to be willing to accept that yoke before we included it in the shell.

George
And he isn't. So far as I am aware, the existing code isn't bust so I have no intention of fixing it.

If I am wrong and it is in fact bust, then someone please post a fix that is easily applied. I am not interested in completely replacing existing code with something different.

: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.
markft
Trader
Posts: 82
Joined: Thu Dec 08, 2011 12:06 pm
Location: Sydney, Australia

Re: Gday: a D1 Stochastic OB/OS trading robot

Post by markft »

No problem, this was a suggestion to easily implement the temporary vs permanent errors idea.
Not sure if an error retry is required. Recalculate at next tick logic should also do the trick you would think.
Rapheal
Posts: 2
Joined: Sun Jan 01, 2012 3:02 pm

Re: Gday: a D1 Stochastic OB/OS trading robot

Post by Rapheal »

Dear all,
What is 'semi-auto"? How to make it work? Does it mean after I enable the EA, I need to choose "buy/sell" manually in the EA ?
thank you
User avatar
fxozgirl
Trader
Posts: 1176
Joined: Wed Nov 16, 2011 9:16 am
Location: Melbourne, Australia

Re: Gday: a D1 Stochastic OB/OS trading robot

Post by fxozgirl »

Rapheal wrote:Dear all,
What is 'semi-auto"? How to make it work? Does it mean after I enable the EA, I need to choose "buy/sell" manually in the EA ?
thank you

Hi Raphael,

Semi Auto means you need to attach the ea to the chart when you have identified a potential trade set up. This allows you to visually confirm the signal before trading.

I personally prefer this method as I like to make sure stoch signal is clearly confirmed at the open of the candle, I also take into consideration the angle of the signal as well before trading.
eg. If stoch signal has crossed over ob/os but is running fairly flat, it would still trigger a trade with the auto ea, however I would probably give it another day to make sure price is definitely starting to trend and not just ranging.
User avatar
Gamma_gallus
Trader
Posts: 118
Joined: Wed Nov 16, 2011 2:03 pm
Location: France

Re: Gday: a D1 Stochastic OB/OS trading robot

Post by Gamma_gallus »

I just wonder how much is the impact of using different brokers / Time zones on this EA (since it takes a position on the open of a new candle)
think.gif
ex. : broker [GMT - 5h] gets a valid signal on EU today, but on a different broker [GMT +2] no more valid signal on the open of the new candle..

Results may be completly random !? (so not worth comparing them)

Anyway i like the simplicity of this system, thanks a lot Fxozgirl !

Gamma
You do not have the required permissions to view the files attached to this post.
User avatar
DING
Trader
Posts: 103
Joined: Wed Nov 16, 2011 11:53 am

Re: Gday: a D1 Stochastic OB/OS trading robot

Post by DING »

Gamma_gallus wrote:I just wonder how much is the impact of using different criminals / Time zones on this EA (since it takes a position on the open of a new candle)
think.gif
ex. : criminal [GMT - 5h] gets a valid signal on EU today, but on a different criminal [GMT +2] no more valid signal on the open of the new candle..

Results may be completly random !? (so not worth comparing them)

Anyway i like the simplicity of this system, thanks a lot Fxozgirl !

Gamma
Hello Gamma,

what is the difference between Gday and your myfxbook Gfay_RevisedV_P10 ?
your Gfay_RevisedV_P10 performance seems better than Gday !
Locked

Return to “Automated trading systems”