indicator execution timing question

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #128007 quote
    WillFR
    Participant
    Junior

    Hello,

    I’m new to the world of indicator programming and I would like to understand how it works.

    When you write an indicator, how often is the code executed ? every tick ? Is there a way to change the frequency of execution ?

    My goal would be to write a simple indicator that tags the candles that are bigger than the last 5 candles, and use this indicator inside a strategy to check at the end of each candle if it is tagged (and if it is, make a trade).

    I have written the indicator but I have some doubts about how frequently its code is executed, and I want to be sure about how to call it from the strategy. Since I only want to get the state of a candle “when it ends”.

    FYI I’m using prorealtime 10.3 at the moment.

    Thanks for your feedback, I hope what I’m asking is clear        🙂

    Guillaume

    #128019 quote
    Vonasi
    Moderator
    Master

    WillFR – Welcome to the forums.

    Please read the forum rules before posting in the forums again. One of them is that all topics should have meaningful titles and describe in some way at least the topic subject. I have edited your topic title.

    Indicator returned values are live/tick by tick on the latest still forming bar on a chart. Once a bar has closed then the value shown for that indicator for that bar is whatever it was at the close of the bar.

    Strategies only execute their code at the close of a bar and so the indicator value will always be whatever it is at the close of the bar.

    #128027 quote
    WillFR
    Participant
    Junior

    Sorry for the not descriptive enough title. And thank you for fixing it. I will re-read the rules.

    Thank you also for the information about the indicator/strategy inner workings. Very clear.

    Just one more question regarding the same topic.

    You said “Strategies only execute their code at the close of a bar and so the indicator value will always be whatever it is at the close of the bar.” but I still have to call the indicator with (close) at the end of the call instruction right?

    #128037 quote
    Vonasi
    Moderator
    Master

    Usually when (close) is used it can be replace with anything such as high, low, open, medianprice, etc as an alternative.  If there is no (close) or alternative then it defaults to close. So a[3](close) is the same as a[3]. With the CALL instruction it is the same but I believe there has to be at least a minimum of (close) when calling an indicator. If the indicator uses CUSTOMCLOSE then whatever is in the () is assigned to the customclose.

    The strategy runs through at the close of a candle and calls the indicator and gets the indicator value/s at the close of the candle.

    #128050 quote
    WillFR
    Participant
    Junior

    Thank you for the very complete answer

    G.

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

indicator execution timing question


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
WillFR @willfr Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by WillFR
5 years, 9 months ago.

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