Counting Stochastic does not work in strategy

Forums ProRealTime English forum ProOrder support Counting Stochastic does not work in strategy

Tagged: 

Viewing 11 posts - 1 through 11 (of 11 total)
  • #111339

    I coded an indicator to simply count how many different stochastics are under a certain level.

    It works fine and returns varying values between zero and 100.

    I then put the same code in a strategy and it only returns zero or 100 and nothing else.

    If I CALL the indicator from the strategy I get 0 or 100 and nothing else too.

    It feels like a weird bug but I might just be missing something really obvious as to why it works as an indicator but not in a strategy.

    If I do the same test with RSI instead of Stochastic then it works fine.

    #111341

    Why do you have trades opened?

    Try GRAPHing j, or replacing FOR…NEXT with WHILE…WEND.

    #111344

    Trades are opened because the image is with the code actually in a working strategy. I was trying to use the flag value for dynamic position sizing. When the position sizes did not change I went looking for the problem and coded the loop as a separate dummy code – it still didn’t work. 🙁

    I already did try changing the FOR NEXT loop with WHILE WEND and that did not work either.

    If I graph J it will just be 100 because the loop has ended!

     

    #111350

    Hello
    I will write

     

    #111351

    fifi743 Thanks for your input but the only difference I can see in your code is the use of DO in line 4 and as far as I am aware DO is an optional instruction so I don’t think that it will make any difference – but I’ll try it anyway!

    In fact I have just coded my own stochastic to try to eliminate the platforms stochastic as being the fault but even with my own calculations I get the same results. It works in a loop in an indicator but not in a loop in a strategy.

     

    #111356

    OK – I’m starting to get somewhere. It has something to do with the averaging in the stochastic calculation. With the following code I get the correct results but this does mean that I can only test STOCHASTIC[j,1].

     

     

    #111357

    you want to get this

    #111359

    Yes – but if I use STOCHASTIC or use AVERAGE in my own calculation of the stochastic value then I get zero or the maximum value of j and no values in between.

    If you see the image in the first post the indicator at the bottom is the exact same code counting stochastics that are below level and it works in an indicator but not in a strategy. There is something wrong in the ProOrder engine that is not wrong in the ProBuilder engine I think.

    #111360

    I coded this dummy strategy that in my mind should be able to calculate a stochastic[j,3] using a second loop to work out the average but even this returns different results to the indicator with settings of [j,3].

    Top graphed line is the strategy and bottom is the indicator.

    I’ll give up for tonight and wait for Nicolas to clock on to work tomorrow morning and see what he makes of it all!

     

    1 user thanked author for this post.
    #111389

    Yes, it reminds me of the problem I encountered in this topic: Possible to code this 3D heatmap in PRT? (Mark Whistler’s Wave PM)

    The conclusion was that the average takes the last calculated data and not the one of the period calculated dynamically in a loop..

     

    #111398

    Yes that all looks very familiar! I wish I’d remembered that topic yesterday as it could have saved a lot of time.

    It seems that it has not yet been fixed.

    It still seems strange that the last code I posted does not work as I tried to eliminate all built in indicators. When in a loop it must be picking up an incorrect value for something but loops are impossible for us to debug with graph so finding out which value is not possible.

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

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