price closes more than 5 points higher than N candlesticks ago

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #153450 quote
    CapnCrunch77
    Participant
    Junior

    Hello folks,

    Does anyone know how to express points move in code?  for example, if a price closes more than 5 points higher than N time frames ago, I want to see a signal (the latter I know how to do, it’s the first part which I’m struggling with!)

    Thanks

    #153452 quote
    robertogozzi
    Moderator
    Master

    Variable Cond will either be true (1) or false (0):

    Cond = close > (highest[5](high[1]) + 5 * pipsize)

    actually any value <> 0, not just 1, is considered to be true.

    CapnCrunch77 thanked this post
    #153459 quote
    Vonasi
    Moderator
    Master

    Roberto’s code will return true if the current close is 5 pips higher than the highest high in the last 5 candles. If you just want it to be 5 pips higher than the close 5 candles ago then you need to use:

    Cond = close > (high[4] + (5 * pipsize))
    
    
    CapnCrunch77 thanked this post
    #153504 quote
    CapnCrunch77
    Participant
    Junior

    Thank you both!!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

price closes more than 5 points higher than N candlesticks ago


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by CapnCrunch77
5 years, 2 months ago.

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