comparing indicator values from x candles ago

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #79483 quote
    simeong
    Participant
    Average

    Hi All,

    Thanks for all the support.

    This is a quick question. I was just wondering if they was a command to compare values [n] candles ago so for example;

    How would I compare if  Bolinger bands were higher than the RSI for the previous two candles.

    Thanks in Advance,

    #79494 quote
    robertogozzi
    Moderator
    Master

    Comparing BB with RSI is impossible, since the first one refers to prices, while the latter to a range (0-100).

    But for other indicators, yes it is easy, let’s say you want to know whether there’s been a CROSSOVER in anyone of the last 3 bars:

    FastMA = average[5,0](close)
    SlowMA = average[25,0](close)
    x = summation[3](FastMA CROSSES OVER SlowMA)  //x will be true if the crossing occurred within anyone of the last 3 bars
    IF x THEN......

    If you want to test specifically the 2nd previous bar you can write:

    x = FastMA[2] CROSSES OVER SlowMA[2] //x will be true if in the 2nd previous bar there's been a crossover

    or (it works the same):

    x = FastMA CROSSES OVER SlowMA //x will be true if there's a crossover
    IF x[2] THEN                   //you test x for the 2nd previous bar
       .
       .
    ENDIF
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

comparing indicator values from x candles ago


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
simeong @simeong Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzi
7 years, 6 months ago.

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