Indicator receives negative value – strategy stop

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #195253 quote
    JohannJohann
    Participant
    Average

    Hi

    Can someone help with this issue. I am using the CCI as a overbought and oversold condition below -100 oversold and above 100 overbought. When the CCI value < -100 then the strategy stops because the indicator returns a negative value perhaps someone can make a suggestion as to how I can code around this?

    Thanks

    Johann

    #195265 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    This code works correctly, no matter tha value CCI returns:

    x = CCI[20](typicalPrice)
    IF x > 50 then
       buy at market
    ELSIF x < -50 then
       sellshort at market
    endif
    //graph x
    Johann thanked this post
    #195267 quote
    JohannJohann
    Participant
    Average

    Thanks Roberto I will try it.

    #195272 quote
    JohannJohann
    Participant
    Average
    x = CCI[20](typicalPrice)
    y = Average[10](CCI[20](typicalPrice))
    IF x > 100 and x > y then
       buy at market
    ELSIF x < -100 and x < y then
       sellshort at market
    endif

    Hi Roberto, so this example should be ok?

    #195274 quote
    JSJS
    Participant
    Master
    DefParam CumulateOrders = False
    
    x = CCI[20](typicalPrice)
    y = Average[10](CCI[20](typicalPrice))
    
    IF x > 250  and x > y then
    buy at market
    ELSIF x < -250 and x < y then
    sellshort at market
    endif

    It works fine…

    After optimization x > 250… 😉

    Johann thanked this post
    Schermafbeelding-2022-06-14-om-17.34.54.png Schermafbeelding-2022-06-14-om-17.34.54.png
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Indicator receives negative value – strategy stop


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Johann @johann Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by JSJS
4 years, 3 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 06/14/2022
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...