TSI Strategy Automation

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #106921 quote
    RiaanvN
    Participant
    Average

    Hello,

    I require assistance please? I have basic strategy which I wish to automate but unfortunately the True Strength Indicator is “not available in ProBuilder language”. I have been using the the following code obtained from a previous forum:

    a = (ExponentialAverage[13](ExponentialAverage[25](ROC[1](close))))
    b = (ExponentialAverage[13](ExponentialAverage[25](ABS(ROC[1](close)))))
    
    TSI = 100 * (a/b)

    Please will you assist with code for TSI(1) and TSI(2)?

    This is my strategy:

    a = (ExponentialAverage[13](ExponentialAverage[25](ROC[1](close))))
    b = (ExponentialAverage[13](ExponentialAverage[25](ABS(ROC[1](close)))))
    
    TSI = 100 * (a/b)
    
    // Conditions to enter long positions
    c1 = TSI < -20
    c2 = TSI > TSI(1) and TSI(1)>TSI(2)
    
    IF c1 and c2 THEN
    BUY 1 lot AT MARKET
    ENDIF

    Thanks

    #106927 quote
    robertogozzi
    Moderator
    Master

    For clarity of messages on ProRealCode’s forums, please use the “insert code PRT” button to separate the text of the code part! Thank you! <<

    At line 8 replace parenthesis with brackets to get  TSI[1] & TSI[2].

    RiaanvN thanked this post
    #106929 quote
    RiaanvN
    Participant
    Average

    Ai, silly me. Thanks Roberto.

    #127524 quote
    Bulle
    Participant
    New

    Hello, i am wondering how do we write a[1] in this exemple?

    Is it this?

    a[1] = (ExponentialAverage[13](ExponentialAverage[25](ROC[1](close))))[1]
    #127526 quote
    Vonasi
    Moderator
    Master

    Please use the ‘Insert PRT Code’ button when putting any code in your posts.

    a = (ExponentialAverage[13](ExponentialAverage[25](ROC[1](close))))

    defines what the value of ‘a’ is for every bar.

    a[1] on its own will just return the value for ‘a’ one bar back from the last bar on the chart.

    #127527 quote
    Bulle
    Participant
    New

    Thanks for your answer so a[1] should be this right?

    a = (ExponentialAverage[13](ExponentialAverage[25](ROC[1](close))))
    
    a[1] =  (ExponentialAverage[13](ExponentialAverage[25](ROC[1](close[1]))))
    
    

    Thanks for your answer so a[1] should be this right?

    I ask this because i want to find the close X such as

    (ExponentialAverage[13](ExponentialAverage[25](ROC[1](close[1]))))-(ExponentialAverage[13](ExponentialAverage[25](ROC[1](X))))=0
    

    Do you have a way to calculate that X?

    #127532 quote
    robertogozzi
    Moderator
    Master

    You cannot assign a value to a past event.

    a[1] is the result of an assignment occurred the previous candle and is read-only.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

TSI Strategy Automation


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
RiaanvN @riaanvn Participant
Summary

This topic contains 6 replies,
has 4 voices, and was last updated by robertogozzi
5 years, 10 months ago.

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