Stochastic Indicator Entry
- This topic has 3 replies, 3 voices, and was last updated 4 years ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
Similar topics:
Forums › ProRealTime English forum › ProOrder support › Stochastic Indicator Entry
Tagged: entry, Stochastic
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:
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
// Conditions to enter long positions TIMEFRAME(2 minutes,UpDateOnClose) indicator1 = Stochastic[15,5](close) indicator2 = Average[5](indicator1) Period = (indicator1[1] AND indicator2[1]) OR (indicator1[2] AND indicator2[2]) c1 = Period < 20 c2 = close > close[1] c3 = (indicator1 > 25) IF (c1 AND c2 AND c3) AND tcondition AND not daysForbiddenEntry THEN BUY 1 PERPOINT AT MARKET ENDIF TIMEFRAME(default) |
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:
1 |
c1 = indicator1 CROSSES OVER indicator2 |
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:
1 2 3 |
c3a = (indicator1 CROSSES OVER 20) c3b = (indicator1 CROSSES OVER 25) c3 = (c3a[1] OR c3a) AND c3b |
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:
1 2 3 |
IF (c1 AND c2 AND c3) AND tcondition AND not daysForbiddenEntry THEN BUY 1 PERPOINT AT MARKET ENDIF |
Find exclusive trading pro-tools on