Simple code returns error message

Viewing 7 posts - 16 through 22 (of 22 total)
  • Author
    Posts
  • #121846 quote
    GraHal
    Participant
    Master

    At Line 5 he defined …

    StocK = Stochastic[15,3](close)
    #121859 quote
    robertogozzi
    Moderator
    Master

    Yes, he can use StocK.

    I think the error is at line 15,

    Line 8 is logically incorrect, since the average after > will always return 3 but it should not be reported as an error.

    #121941 quote
    cyrillic
    Participant
    Junior

    Thank you Roberto
    I was trying to describe a rising 50 moving average.
    Would If avg[50](close)>avg[50][3] then….. be correct.
    I know the trailing moving average omits (close) because it’s already
    happened, I got the wrong brackets for the 3 which was supposed to be 3 candles back.
    back.
    The StocK>80 then…. line did work .
    Is all this correct ?

    #121951 quote
    robertogozzi
    Moderator
    Master

    Ok, fine.

    Yes, that’s correct!

    cyrillic thanked this post
    #122627 quote
    cyrillic
    Participant
    Junior

    Hi
    Please how do I show if the MACD is above or below the MACDSignal line.?

    kimjimbel thanked this post
    #122670 quote
    robertogozzi
    Moderator
    Master

    There you go:

    MyMACDmainline  = MACDline[12,26,9](close)              //difference between the two EMA's
    MyMACDsignal    = ExponentialAverage[9](MyMACDmainline) //ema of the above line (MyMACDmainline)
    MyMACDhistoGram = MACD[12,26,9](close)                  //histogram
    AboveMACD       = MyMACDmainline > MyMACDsignal
    BelowMACD       = MyMACDmainline < MyMACDsignal

    you can use variables AboveMACD and BelowMACD in your code (in the above code the histogram is not used,  if you don’t need it you may want to either remove or comment out line 3).

    cyrillic and aland thanked this post
    #122675 quote
    GraHal
    Participant
    Master

    Above added as Log 203 in here …

    Snippet Link Library

    robertogozzi thanked this post
Viewing 7 posts - 16 through 22 (of 22 total)
  • You must be logged in to reply to this topic.

Simple code returns error message


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
cyrillic @cyrillic Participant
Summary

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

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