RSI, Stochastic and Ichi Pine code strategy conversion request.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #126443 quote
    deleted03052020
    Member
    New

    Hi,

    I need help to modify a PRT code from pine.

    (I use it on dax3m and get 70%+ results on backtest)

    If you have a beter alternative/TWEAK to get better results your free to change it. Please take your time and check. Code is posted below. And I hope i´ve posted this in the right forum because im new on this site.

    //@version=4
    strategy(“My Strategy”, overlay=true)
    
    sourceInput = input(close)
    emaLengthInput = input(defval=62, title=”EMA Length”, type=input.integer)
    rsiInput = input(defval=14, title=”RSI Length”, type=input.integer)
    
    // stoch
    stochLengthInput = input(defval=14, title=”Stoch Length”, type=input.integer)
    stochFastInput = input(defval=3, title=”Stoch Fast”, type=input.integer)
    stochSlowInput = input(defval=3, title=”Stoch Slow”, type=input.integer)
    stochBuySignalInput = input(defval=20, title=”Stoch Buy Signal Input”, type=input.integer)
    stochSellSignalInput = input(defval=80, title=”Stoch Sell Signal Input”, type=input.integer)
    
    // rsi
    rsi = rsi(sourceInput, rsiInput)
    
    // ichi
    tenkanPeriods = input(9, minval=1, title=”Tenkan-sen period”)
    kijunPeriods = input(26, minval=1, title=”Kijun-sen period”)
    senkouSpanBPeriods = input(52, minval=1, title=”SenkouSpanB period”)
    chikouDisplacement = input(26, minval=1, title=”Chikou displacement”)
    
    // calcs
    ema = ema(sourceInput, emaLengthInput)
    stoch = stoch(close, high, low, stochLengthInput)
    stochFast = sma(stoch, stochFastInput)
    stochSlow = sma(stochFast, stochSlowInput)
    
    donchian(len) => avg(lowest(len), highest(len))
    
    tenkan = donchian(tenkanPeriods)
    kijun = donchian(kijunPeriods)
    senkouA = avg(tenkan, kijun)
    senkouB = donchian(senkouSpanBPeriods)
    chikou = sourceInput
    plot(chikou, offset= -chikouDisplacement + 1, color=#000000)
    
    buySignal = false
    
    // sell
    stochSellSignal = stochFast > stochSellSignalInput and crossunder(stochFast, stochSlow)
    rsiSignal = change(rsi) < 0
    ichiSellSignal = chikou < sourceInput[chikouDisplacement-1]
    
    sellSignal = stochSellSignal and rsiSignal and ichiSellSignal
    
    shortProfitPerc = input(title=”Short Take Profit (%)”, minval=0.0, step=0.1, defval=0.5) / 100
    shortLossPerc = input(title=”Short Stop Loss (%)”, minval=0.0, step=0.1, defval=0.5) / 100
    
    if(sellSignal)
    strategy.entry(“Short”, long=false)
    
    if (strategy.position_size < 0)
    shortExitPrice = strategy.position_avg_price * (1 – shortProfitPerc)
    shortStopPrice = strategy.position_avg_price * (1 + shortLossPerc)
    strategy.exit(id=”XS CloseShort”, limit=shortExitPrice, stop=shortStopPrice)
    
    if hour == 17 and minute == 28
    strategy.close_all()
    
    plot(kijun, color=color.new(color.red, 0))
    plot(ema, color=color.new(color.blue, 0))
    barcolor(buySignal ? color.new(color.blue, 0) : sellSignal ? color.new(color.red, 0) : na)
    #126444 quote
    robertogozzi
    Moderator
    Master

    Now you posted it correctly. I deleted the wrong one in ProBuilder support.

    To ask for free conversions you should follow this link https://www.prorealcode.com/free-code-conversion/

    describing the strategy as much as possible, preferably attaching some screenshots.

    thanked this post
    #126455 quote
    Vonasi
    Moderator
    Master

    Welcome to the forums. You have managed to break four of the simple forum rules with your very first topic and you broke one of them twice! I’ll check with the Guinness book of records as we might be able to get your name in their book.

    There are some simple rules that everyone using the forums is expected to follow.

    The forum rules are as follows. I have highlighted in bold the rule/rules that you have not followed:

    Post your topic in the correct forum.

    ProRealTime Platform Support          only platform related issues.
    ProOrder                                                only strategy topics.
    ProBuilder                                              only indicator topics.
    ProScreener                                           only screener topics
    General Discussion                               any other topics.
    Welcome New Members                      for new forum members to introduce themselves.

    Only post in the language of the forum that you are posting in. For example English only in the English speaking forums and French only in the French speaking forums.
    Always use the ‘Insert PRT Code’ button when putting code in your posts to make it easier for others to read.
    Do not double post. Ask your question only once and only in one forum. All double posts will be deleted anyway so posting the same question multiple times will just be wasting your own time and will not get you an answer any quicker. Double posting just creates confusion in the forums.
    Be careful when quoting others in your posts. Only use the quote option when you need to highlight a particular bit of text that you are referring to or to highlight that you are replying to a particular member if there are several involved in a conversation. Do not include large amounts of code in your quotes. Just highlight the text you want to quote and then click on ‘Quote’.
    Give your topic a meaningful title. Describe your question or your subject in your title. Do not use meaningless titles such as ‘Coding Help Needed’.
    Do not include personal information such as email addresses or telephone numbers in your posts. If you would like to contact another forum member directly outside of the forums then contact the forums administrator via ‘Contact Us’ and they will pass your details on to the member that you wish to contact.
    Always be polite and courteous to others.
    Have fun.

    I have edited your post where required. Please ensure that your future posts meet these few simple forum rules. 🙂

    #126463 quote
    bertrandpinoy
    Participant
    Veteran

    The code don t run (have a look ti the picture attached). see you soon.

    Sans-titre-5.png Sans-titre-5.png
    #126465 quote
    MAKSIDE
    Participant
    Veteran

    The code don t run (have a look ti the picture attached). see you soon.

    It’s not a PRT code…..

    #126466 quote
    deleted03052020
    Member
    New

    Yeah its not a prt code. I need help to make it a PRT from pine.

    #126501 quote
    deleted03052020
    Member
    New

    Also if you solve this. Please mail me at *****

    #126528 quote
    Nicolas
    Keymaster
    Master

    Another rule is:

    • Do not include personal information such as email addresses or telephone numbers in your posts.

    If you want to get updated on each new post of a topic, please subscribe (button is at the top right of each page).

    thanked this post
    #128765 quote
    deleted03052020
    Member
    New

    Nicolas can you please remove this post from the forum?

    #128771 quote
    Nicolas
    Keymaster
    Master

    Why do you want it to be deleted? If I did not do the conversion yet, it doesn’t mean that I will not do it! If you can wait I will help, dont worry 😉

    #128820 quote
    deleted03052020
    Member
    New

    Well I havent got any help yet and seems like noone wants to help.

    #128841 quote
    Nicolas
    Keymaster
    Master

    If you think it’s long, you can also learn to code or use the platform programming assistant. Many have learned this way. I will try to help you but you must also be patient, thank you.

    #129519 quote
    deleted03052020
    Member
    New

    By trying to learn i´ve came this far and acctually hard troubleshooting when im new. Hopefully someone could help with this.

    // Conditions to enter short positions
    IF NOT ShortOnMarket AND YourConditions THEN
    SELLSHORT 1 CONTRACTS AT MARKET
    ENDIF
    
    // Conditions to exit short positions
    IF ShortOnMarket AND YourConditions THEN
    EXITSHORT AT MARKET
    ENDIF
    
    // Stops and targets : Enter your protection stops and profit targets here
    
    // stoch
    stochLengthInput = input(defval=14, title="Stoch Length", type=input.integer)
    stochFastInput = input(defval=3, title="Stoch Fast", type=input.integer)
    stochSlowInput = input(defval=3, title="Stoch Slow", type=input.integer)
    stochSellSignalInput = input(defval=80, title="Stoch Sell Signal Input", type=input.integer)
    
    // rsi
    rsi = rsi(sourceInput, rsiInput)
    
    // ichi
    tenkanPeriods = input(9, minval=1, title="Tenkan-sen period")
    kijunPeriods = input(26, minval=1, title="Kijun-sen period")
    senkouSpanBPeriods = input(52, minval=1, title="SenkouSpanB period")
    chikouDisplacement = input(26, minval=1, title="Chikou displacement")
    
    // short
    stochSellSignal = stochFast > stochSellSignalInput and crossunder(stochFast, stochSlow)
    rsiSignal = change(rsi) < 0
    ichiSellSignal = chikou < sourceInput[chikouDisplacement-1]
    
    sellSignal = stochSellSignal and rsiSignal and ichiSellSignal
    
    shortProfitPerc = input(title="Short Take Profit (%)", minval=0.0, step=0.1, defval=0.5) / 100
    shortLossPerc = input(title="Short Stop Loss (%)", minval=0.0, step=0.1, defval=0.5) / 100
    
    if(sellSignal)
    strategy.entry("Short", long=false)
    
    if (strategy.position_size < 0)
    shortExitPrice = strategy.position_avg_price * (1 - shortProfitPerc)
    shortStopPrice = strategy.position_avg_price * (1 + shortLossPerc)
    strategy.exit(id="XS CloseShort", limit=shortExitPrice, stop=shortStopPrice)
    #129523 quote
    Vonasi
    Moderator
    Master

    Another post from you and another forum rule broken. Use the ‘Insert PRT Code’ button!

    As you claim that this constant disregard for the few simple rules is due to your poor English I have created some pictures for you.

    I have once again wasted my own time tidying up your posts.

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

RSI, Stochastic and Ichi Pine code strategy conversion request.


ProOrder: Automated Strategies & Backtesting

New Reply
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/16/2020
Status: Active
Attachments: 3 files
Logo Logo
Loading...