Multi 10:4 Trader EA

Post Reply
User avatar
slipshod
Trader
Posts: 404
Joined: Tue Dec 27, 2011 9:14 am
Location: Australia

Re: Multi 10:4 Trader EA

Post by slipshod »

Hi Andy, if its ok I'll add some code below (will edit this post when done) as a tide-over until you're back & can do the job properly. Don't worry mate, enjoy your holiday - we'll keep the fires burning until you're back :)

Edit: Ok firstly you'll need to add the following to the EA's code up the top - in v1.09 its at line 83 under the // candletiger comment.

Code: Select all

extern bool   useAO = true;
extern bool   useStoch = true;
extern bool   useRSI = true;
Leave UseRSIInsteadOfStoch there, as it'll be used for dashboard display purposes - but no longer for the actual trading.

Then line 2310-ish you'll see the function trendDirect() replace it with the following:-

Code: Select all

bool trendDirect(string symbol, int type)
{
    double mA   = iMA(symbol, PERIOD_H4, 240, 0, MODE_LWMA, PRICE_OPEN, 0);
    double sT   = iStochastic(symbol, PERIOD_H4, 5, 3, 3, MODE_LWMA, 1, MODE_SIGNAL, 0);
    double aO   = GetAo(symbol, PERIOD_H4, 0);
    double aO1  = GetAo(symbol, PERIOD_H4, 1);
    double lO   = iLow(symbol, PERIOD_H4, 0);
    double hO   = iHigh(symbol, PERIOD_H4, 0);
    double gRSI = GetSlopeRSI(symbol, PERIOD_H4, 0);

    if (useStoch)
    {
       if (type == OP_BUY)
       {
           if (useBothForPullback)
           {
               if (lO > mA && sT < 20 && aO < 0 && aO1 < aO)
                   return(true);
           }
           else if (lO > mA && sT < 20)
               return(true);
       }

       if (type == OP_SELL)
       {
           if (useBothForPullback)
           {
               if (hO < mA && sT > 80 && aO > 0 && aO1 > aO)
                   return(true);
           }
           else if (hO < mA && sT > 80)
               return(true);
       }
    }

    if (useRSI)
    {
        if (type == OP_BUY)
        {
            if (useBothForPullback)
            {
                if (lO > mA && gRSI < RSITMAlowlevel && aO < 0 && aO1 < aO)
                    return(true);
            }
            else if (lO > mA && gRSI < RSITMAlowlevel)
                return(true);
        }

        if (type == OP_SELL)
        {
            if (useBothForPullback)
            {
                if (hO < mA && gRSI > RSITMAhighlevel && aO > 0 && aO1 > aO)
                    return(true);
            }
            else if (hO < mA && gRSI > RSITMAhighlevel)
                return(true);
        }
    }

    if (useAO)
    {
        if (type == OP_BUY && lO > mA && aO < 0 && aO1 < aO)
            return(true);
        else if (type == OP_SELL && hO < mA && aO > 0 && aO1 > aO)
            return(true);
    }

    return(false);
}
A few things to note:-

Its not a choice whether to use Stoch or RSI. You can use both or either. Just make sure one of them at least is set to true.

Awesome Oscillator is used as a confirming measure for Stoch/RSI trades if you set useBothForPullback to true, or as an entry in its own right if you set useAO to true. Set both those to false and it won't be used at all. The AO needs to be in positive territory for a sell trade or negative for a buy trade, and it now needs to have moved closer to the other direction than the previous H4 candle as that's how I read Bob's rule in the manual.

Lastly if I've stuffed something up here by all means don't hesitate to point it out!

Edit: improved the logic a bit, separating out the useAO parts from the useStoch and useRSI. Should work exactly the same.
Last edited by slipshod on Wed Apr 03, 2013 11:26 am, edited 6 times in total.
MrLong

Re: Multi 10:4 Trader EA

Post by MrLong »

slipshod wrote:Hi Andy, if its ok I'll add some code below (will edit this post when done) as a tide-over until you're back & can do the job properly. Don't worry mate, enjoy your holiday - we'll keep the fires burning until you're back :)

Ok thanks.
User avatar
slipshod
Trader
Posts: 404
Joined: Tue Dec 27, 2011 9:14 am
Location: Australia

Re: Multi 10:4 Trader EA

Post by slipshod »

Code changes posted above, happy trading all.
User avatar
Jonathan2FI
Trader
Posts: 119
Joined: Fri Jun 15, 2012 9:26 am
Location: Birmingham, Frankfurt, Brussels

Re: Multi 10:4 Trader EA ...useboth

Post by Jonathan2FI »

Slipshod,
1. the "use both for pull back" RSI & AO usually results in fewer but larger 10.4 moves - do you see merit in the option to flex profit taking / money management accordingly (compared to trades that do not have both)? Although adding complexity is still inline with NB 10.4.

Jonathan

ps. Cracking System 10.4 and this EAv2 brings with it massive potential for trader to use at the core of their trading while providing enough room to bring their own preferences/skills in- but not so much room that they hang themselves.
Last edited by Jonathan2FI on Wed Apr 03, 2013 12:32 pm, edited 1 time in total.
User avatar
slipshod
Trader
Posts: 404
Joined: Tue Dec 27, 2011 9:14 am
Location: Australia

Re: Multi 10:4 Trader EA

Post by slipshod »

Jonathan, I'd guess that'd make sense - no point cutting short a trade that in theory could run further than your average entry. I don't know that the EA should set a different TP though, instead it should be something that the user takes care of, either by deleting the TP on those trades or moving them away.

I guess the EA could assist by detecting when trades do indeed match the RSI+AO or Stoch+AO, regardless of whether useBothForPullback has been set to true or not, and identifying such trades in the comment - that'd help you see which ones to manage in that way. You may also want to avoid them getting taken out in a basket closure, probably by setting a higher limit and/or more relaxed profit trailing %.
User avatar
simplex
Trader
Posts: 127
Joined: Thu Feb 07, 2013 5:21 pm
Location: An insignificant small town close to an insignificant former capital at the Rhine River.

Re: Multi 10:4 Trader EA

Post by simplex »

linuspoon wrote:Hi Andy,

There is a minor bug in the Comments of trades fired for V2.00. Instead of taking what is in the external variable, the comment is now "Magic: <Magic#>". Also, the error "object name passed to ObjectSetText function cannot be an uninitialized or empty string" I reported earlier is still there in V2.00 if I set the GridMethod to 0. This error is not there when GridMethod is 1.

Linus
Hi Linus,

I never faced this error - neither on my development machine nor on test.

Can you provide ANY information about the circumstances this error occurs? Only on EA startup? On every tick? After trade open? After trade close? ... etc. The more detail you can provide the better. Already did a code review, found nothing ...

Cheers, simplex
If you can't explain it simply, you don't understand it well enough. (Albert Einstein)
It appears that the Weighted Moving Average was invented by a trader who did not have a firm grasp of filter theory in hopes of reducing lag. (John F. Ehlers)
User avatar
simplex
Trader
Posts: 127
Joined: Thu Feb 07, 2013 5:21 pm
Location: An insignificant small town close to an insignificant former capital at the Rhine River.

Re: Multi 10:4 Trader EA

Post by simplex »

Hi Andy,

I was bound outside this forum and EA development for a few days. Checking back found your 2.0: great work, very impressive!

Yesterday evening I already had a quick look on 'my' part and found a few minor issues in your changes, mostly colour management. I suggest I will PM you and you can integrate the changes in your next release. There's no need to hurry here and this way we don't interfere with the other more important issues that are discussed currently.

Ok?

Cheers, simplex
If you can't explain it simply, you don't understand it well enough. (Albert Einstein)
It appears that the Weighted Moving Average was invented by a trader who did not have a firm grasp of filter theory in hopes of reducing lag. (John F. Ehlers)
User avatar
slipshod
Trader
Posts: 404
Joined: Tue Dec 27, 2011 9:14 am
Location: Australia

Re: Multi 10:4 Trader EA

Post by slipshod »

Simplex, great work on optimising the dashboard, really takes minimal CPU on my end now - much appreciated!

Btw this has got to be the best collaborative effort on an EA I've seen - totally disorganised but somehow people are naturally contributing in different areas with minimal overlap, with Andy still captain of the ship even on holidays. Progress being made at a breakneck speed, can't wait to see where this ends up :)
User avatar
Jonathan2FI
Trader
Posts: 119
Joined: Fri Jun 15, 2012 9:26 am
Location: Birmingham, Frankfurt, Brussels

Re: Multi 10:4 Trader EA

Post by Jonathan2FI »

Andy, Slipshod,
thanks I get it . In terms of Trade Selection - Trade Timing - Trade Management this EA handles the first 2 say at 75% and the Trade Management at say 50% - very subjective numbers but underlining the point this is not a fire and forget with more trader focus and intelligent intervention opportunity/ requirements on trade management rather than selection and timing.

After 3 weeks of understanding, testing and analysing I feel comfortable with running v2 on small live accounts at 1%R with a further equity protection EA in the background as belt and braces also on reliable VPS. Plus checking/adjusting every evening. Although this is a 4h system and I am EOD trading I prefer the option of running this EA as 4H rather than converting to 10.4 to D1.
Jonathan
User avatar
McNish
Trader
Posts: 227
Joined: Tue Nov 06, 2012 3:56 pm

Re: Multi 10:4 Trader EA

Post by McNish »

Hey Guys,
I'm so happy to see you all pointing out so many bugs. I'll pitch in some myself.

Regarding the different trades on different brokers, I suggest we benchmark one broker for comparing results. Same stuff is happening all over at the DBM thread. So nothing new here, it's broker feed IMO and I suggested the same thing to Bunks too.
McNish wrote:DeletePendIfMACross: The pendings are auto delete if MA cross is set to true. The pends will re-populate in next h4 bar if no MA cross and conditions are met.
Andy confirmed to this. "Yes if we change sides the ea will start to build if the conditions are correct."
I suggest a change here. If the PA crosses to the other side, then either
1. No more trades for that day
or
2. No more trades in that H4 candle hour.
What I see contrary to this is that as soon as the PA crosses back into original territory, it starts taking orders even though the current bar has peeked to the other side of the MA and retraced. Thus better would be to not take any more checks or orders if the current H4 has peeked across or current D1 has peeked across. Something on these line TIB suggests too.
McNish wrote:Sell : Say at any point if the conditions are true, next SR is MR1, TP is MSR2. How many pends will be set, 4? MR1, P, MS1, S1. TP for all this will be MS2?
Please confirm this, someone. I'm getting couple trades that I think are wrong if above stated is true.
candletiger wrote:great work, I like the new buttons, ...
Sure U do, so do we. Thanks, you're a Champ !
Slipshod wrote:Ok I'm jealous now ...
Don't have to be, just go live and the feeling will reciprocate. :lol: Thanks for the signature.

@ Andy : AO, Oh ho, here we go, ... again. Cheers !

Regards to All, Max.
Post Reply

Return to “Nanningbob 10.x”