Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Simple ... Question offset and... > above...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Simple ... Question offset and... > above...

    I try search... but not find ...i want test (to learn) a simple strategy and have some questions with patient for me...

    like:
    Close today > sma4
    sma3> sma 6
    Enter long
    ....

    Only in info about day close at some instrument.

    1º What is difference if I choose ">" or "Cross above" ?
    And in "Cross above" what is "look back period"?

    2º When define sma and close ... i have parameters:
    in Sma I choose "Bars ago" 1 ? or 0?
    and same but in "close today" choose 0?

    3º In "Offset type", choose "Price" or....?

    4º and in only "Offset"? What choose? 0 ? This is what for?



    It is:
    Code:
    CalculateOnBarClose = true
    if (CrossAbove(SMA(3), SMA(6), 1)
                    && CrossAbove(Close, SMA(4), 1))
                {
                    EnterLong(DefaultQuantity, "");
    ...
    Edit:
    How code this:
    "2 period RSI 2 falls 3 day in a row"?

    Thanks
    Last edited by jmagaia; 08-19-2013, 05:30 PM.

    #2
    In no particular order as I find it in the help files:

    SMA(int period)[int bars ago]

    so SMA(20)[1] is the sma of 20 periods, 1 bar ago.

    Using "CrossAbove" Or Below is just a heck of a lot easier than doing it long-form. They did the work for you. Look-back is what you're comparing the current bar off of, which is typically the previous bar, thus the "1" bar look-back.

    Example here:
    // Go long we have an up bar and the 10 EMA crosses above 20 EMA within the last 5 bars
    if (Close[0] > Open[0] && CrossAbove(EMA(10), EMA(20), 5))
    EnterLong();


    Similar syntax to SMA is Close.

    Close[0] is the closing price of the most current bar, so something like,

    if (Close[0] > Close[1]) // true if current close is greater than the previous close.
    hope it helps.

    Comment


      #3
      jmagaia, in addition to Steve's reply you would find this likely helpful to further clarify -



      For the RSI example, you would check the RSI value then against the previous RSI value to compare and formulate your condition, the CrossOver was implemented as convenience method really, you can also express the same item with the <> comparions, i.e. if the RSI this bar is higher than 30, but previous bar it was lower > then it must have crossed over.

      Offset would allow you to add lets say 'wiggle' room to the value compared to, i.e. RSI + 5 points or Close + 2 ticks.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      649 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      370 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      109 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      574 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      576 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X