Coding the stochastic

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #70256 quote
    Juan Salas
    Participant
    Master

    Hi all,

    I have some problem coding the stochastic. I want to code the stochastic and I think I have it right, but following the demo account on live, I can see the orders are launched two bars later than it should. That make me think that the stochastic I have coded is different than the stochastic I have as indicator in PRT.

    I have set the Stochastic to (79,3,1) in the indicators section in PRT, but when it comes to coding only shows two parameters: Stochastic [79,3]. So, I would like to launch a BUYING order when the stochastic (79,3,1) crosses over the line of 50.

     

    I thought that I had it right, but it doesn’t seems to work right.

    What I did:

    stoch76=stochastic[76,3]
    //D=average[1](stoch76)
    
    LONG= stoch76 crosses over 50
    SHORT= stoch76 crosse under 50

    Anyone can tell me if this is right??

    Thanks in advance,

    Juan

    #70257 quote
    robertogozzi
    Moderator
    Master

    1. (close)  is missing at the end of line 1, but it is probably assumed so it shouldn’t be the cause, but documentation has it;

    2. your text talks about 79, while your code reads 76, could this be the problem?

    Juan Salas thanked this post
    #70272 quote
    Nicolas
    Keymaster
    Master

    1 means the period of the signal line of the stochastic, which is a simple moving average of 1 period in your example. If you are not using it,  and since a 1 period sma is the same value of the stochastic, your code is already good.

    Juan Salas thanked this post
    #70278 quote
    Juan Salas
    Participant
    Master

    Hi Roberto and Nicolas,

    Roberto: Yes, you are right about 79 and 76. It was just my mistake here. In the code it is correct (76). I think, the delay, must be a code reading problem of PRT demo. I assumed close at the end was inferred.

    Nicolas: I am not using D value in the code, so I have set it up to one.

    I will continue working on this with more confident, knowing than the indicator and the code are fine.

    Thank you very much to both of you.

    Juan

    #103909 quote
    Robert Berenbaum
    Participant
    New

    How do I code a stochastic with a  8-3-3 setting?  Thanks!

    #103910 quote
    robertogozzi
    Moderator
    Master

     Please update your country flag in your profile. Thank you 🙂

    K = stochastic[8,3]
    D = average[3](K)
    #103911 quote
    Vonasi
    Moderator
    Master
    Robert Berenbaum – please do not double post! It does not get you a faster answer. It just wastes the time of those who are trying to help you. I will delete your identical post in the ProScreener forum to save others from wasting their time trying to provide you with an answer that you have already been given here.
    #103932 quote
    Nicolas
    Keymaster
    Master
    I also answered the same question in the documentation section! 👿
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.

Coding the stochastic


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Juan Salas @juan-salas Participant
Summary

This topic contains 7 replies,
has 5 voices, and was last updated by Nicolas
6 years, 7 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 05/12/2018
Status: Active
Attachments: No files
Logo Logo
Loading...