Indicator receives negative value – strategy stop

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #195253 quote
    Johann
    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
    robertogozzi
    Moderator
    Master

    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
    Johann
    Participant
    Average

    Thanks Roberto I will try it.

    #195272 quote
    Johann
    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
    JS
    Participant
    Senior
    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.

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 JS
3 years, 8 months ago.

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