MACD Stochastic code

Forums ProRealTime English forum ProScreener support MACD Stochastic code

Tagged: , ,

Viewing 13 posts - 1 through 13 (of 13 total)
  • #75857

    Good morning all,

    Can anyone help with a screener for a MACD Stochastic code to screen for Stochastic crossover (default settings 14,3,5)  followed by MACD (default settings) crossover in the same direction within two candlesticks of each other?

    Thank you.

    KR,

    MM

    #75865

     

    2 users thanked author for this post.
    #76112

    Good morning robertogozzi,

    Thanks for the above. Can you help with a code for a buy signal when MACD is already above the zero line and stochastic (settings 14,3,5) %K crosses over %D and a sell signal when MACD is already below the zero line and stochastic (settings 14,3,5) %K  crosses under %D?

    Cheers.

    KR.

    MM

    #76115

    There you go, it will return either 1 for LONG signals or 2 for SHORT signals (not tested, though):

     

     

    1 user thanked author for this post.
    #76120

    Hi,

    I’ve tested it and it’s working well. Cheers.

    1 user thanked author for this post.
    #80306

    Hi all,

    I wonder if you could help me with a procode. Let me see if I make sense.

    I’m trying to write a screener code for two timeframes, let’s say. Daily and 4Hours

    Below are my criteria

    1. Stochastic 14,3,5 should cross within MACD on the daily TF first with ADX above 20 and increasing
    2. Then on the 4 hour TF, stochastic to cross and be in the same direction as Daily, or alert if it’s already in the same direction as Daily.

    So even if the stoch has crossed on the daily, there shouldn’t be an alert until H4 stoch crosses in the same direction.

    I hope I made sense: it’s been a long day.

    Thanks.

    KR,

    MM

    #80326

    I’ll work on it tomorrow.

    1 user thanked author for this post.
    #80338

    Thanks. Bless.

    #80351

    Up         = StocK CROSSES OVER StocD

    Up         = Up AND MacdVal > 0

    I have to ask as I get confused when I see code like above 🙂

    How can Up = x AND ALSO  … Up = x +y ??

    Is it because Up = x + y is the last line of code stating what Up =  … so that is what PRT works on??

    Hope that makes sense??

    #80376

    Up = StocK CROSSES OVER StocD
    Up = Up AND MacdVal > 0
    I have to ask as I get confused when I see code like above 🙂
    How can Up = x AND ALSO  … Up = x +y ??
    Is it because Up = x + y is the last line of code stating what Up =  … so that is what PRT works on??
    Hope that makes sense??

    I could have written

    but for clarity i split the line in two to make it easier to read and debug.

    Actually two simple conditions is not much trouble, but with more conditions this way is much more readable and easier to debug (for me), despite it may waste some newlines, but adding some text won’t affect performance.

    It’s because AND requires that ALL conditions be TRUE, no matter if you split it in more lines. Some compilers may skip the second line if the first one is false.

    I could also have written

    but this is off topic now, should you have other similar questions you would like to be answered I suggest that you open a new topic in the General Trading forum (this is coding automatic trading).

     

     

    1 user thanked author for this post.
    #80378

    Hi all,
    I wonder if you could help me with a procode. Let me see if I make sense.
    I’m trying to write a screener code for two timeframes, let’s say. Daily and 4Hours
    Below are my criteria
    1.  Stochastic 14,3,5 should cross within MACD on the daily TF first with ADX above 20 and increasing
    what does WITHIN mean? should they both cross at the same time?

    #80620

    Hi,

    Means that a bearish stochastic crossover happens after a bearish MACD has formed and vice versa. Hope that makes sense.

    Thanks.

    MM

    #80708

    There you go, give me some feedback after testing it:

    1 user thanked author for this post.
Viewing 13 posts - 1 through 13 (of 13 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login