Stochastic Indicator Entry

Forums ProRealTime English forum ProOrder support Stochastic Indicator Entry

Tagged: ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • #105871

    I’m a bit new to coding so please bear with my silly questions?

    I am trying to develop an entry using the Stochastic indicator, but am struggling to set up a couple of conditions.

    I want to enter LONG when:

    1. The Stoch %K has been below 20% i.e. oversold
    2. Then it Crosses Over Stoch %D
    3. And then moves above 25%

    I am struggling to code the sequencing i.e. has been below 20% but now has crossed over and is above 25% – I guess the main thing I want to know is about setting a condition (trading below 20%) and the the code remembering it for the next phase of the filter?

    Any help would be most grateful  – I’ve attached my attempt at this part of the code and a marked up screen shot

     

     

    #105873

    Welcome to the forums – I see this is your first topic and post.

    Please use the ‘Insert PRT Code’ button when posting code as it makes it so much easier for others to read. I have tidied up your post for you. 🙂

    #105876

    Firstly, you want to code a strategy, but you posted on the wrong forum (ProBuilder, reserved to indicators/oscillators). I’ll move it to ProOrder.

    At line 7 you are assigning PERIOD a logical value, true (1) or false (0). In both case it’s < 20 so C1 at line 7 will ALWAYS be true! (it will be replaced by new lines 11-13). It must be changed to check K has crossed over D:

    Line 10 looks good, it just makes sure the prise is going north.

    Line 11 needs to be changed and made of three lines to make sure it has both crossed over 20 and 25 at the same time or it just crossed over 25 and the previous candle had crossed over 20:

    Finally, line 13 cannot be written like that, did you ever test this piece of code?  NO, otherwise you’d have been warned about this syntax error. IF and ENDIF cannot be on the same line AND the action to be taken must be in between:

     

     

     

    #105897

    Thanks for this Robertogozzi,

    I appreciate your reply and insight, I’ll give it a go.

    Kind regards

    Steve

Viewing 4 posts - 1 through 4 (of 4 total)

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