stochastic indicator

Forums ProRealTime English forum ProBuilder support stochastic indicator

Viewing 8 posts - 1 through 8 (of 8 total)
  • #111282

    Hello,

    Can someone help me how to code an indicator that returns the difference in pips between enter at < 20 and exit at >80.

    Thank you.

    #111285

    Trebor – Welcome to the forums.

    You may need to give a little more info. What do you mean exactly by pips between >80 and < 20? Do we start counting when the stochastic crosses up or when it crosses down over each of these values? What do we do if it recrosses the 20 – do we start counting again or ignore it?

    #111286

    Hi Vonasi,

    Thank you for your answer and thank you for the welcome

    I would like to get it start to count when %K enters <20 and stop count when it becomes >80. I would like to get the difference between entering <20 and to entering >80. Also as you write, I would not like it to start to recount if it reenters <20 before it has entered >80. Hope this is enough information.

    #111290

    Try this:

     

    1 user thanked author for this post.
    #111310

    Thank you.

    #111317

    Added as Log 182 to here …

    Snippet Link Library

    1 user thanked author for this post.
    #111322

    Just for fun I turned it into something that draws lines on the chart from the open to the close of the simulated trade. The total gain or loss is also displayed on the chart at the close of each trade. Lines and values are red for losers and green for winners.

    I also added a spread value that is subtracted from the results to more accurately simulate what the gain or loss might be. Change it to match whatever instrument you are using the indicator on or set to zero to test with no spread.

    Apply the indicator to the price chart.

     

     

    1 user thanked author for this post.
    #111327

    I must be really bored because I developed it a bit further. This version also calculated the returns for going long or short and displays them on the chart. It displays the gain or loss on this trade, the average gain per trade, the win rate for all trades and the total gain or loss for all trades.

    • G = Total gain
    • AvgG = Average Gain per Trade
    • WR = % Win Rate
    • Unlabelled = The gain or loss for this trade.

     

    Long trade results are above the candle in green and short trade results are below in red.

     

    I also turned the code into a line chart to show the historical results. You can turn on or off which of the three line types are displayed.

    Really it would be easier just to write a strategy to get all this same information but like I said I was bored!

     

     

     

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

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