Calculate bars distance from Point 1 to Point 2

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #119898 quote
    raibel
    Participant
    Junior

    Hello together,

    1.) how can I get the price or the intraday bar index back from point 1 and / or point 2 (such as TradeIndex or TradePrice).
    2.) How do I calculate that after point 1 point 2 is reached after [n] bars

    Screenshot_9.png Screenshot_9.png Screenshot_9-1.png Screenshot_9-1.png
    #119902 quote
    Vonasi
    Moderator
    Master

    Welcome to the forums.

    You need to define how point 1 and point 2 are identified. We can’t guess.

    TRADEINDEX is the index number of the last bar that an order was filled at.

    TRADEPRICE is the last price an order was filled at.

    Your question is a little difficult to understand without more detail.

    #119917 quote
    raibel
    Participant
    Junior
    thanks for the answer … okay i try to explain it better.
    It doesn’t really matter how point 1 comes about, it can be a line or a moving average or whatever. I am concerned that, if the point triggered I get a value back.
    to question 1)
    Yes like TradePrice, but there is no order in the market yet, I only need to get the Price or IntradayBarIndex back.
    e.g. (Price crosses over a Line = Point 1) … I would like to get the value or the BarIndex back here.
    to question 2)
    e.g. (Price crosses over a Line = Point 1) I would like to know here if the line 2 is undershot after [n] bars ((Price crosses under a Line = Point 2).
    I hope it is easier to understand now!?
    #119921 quote
    Vonasi
    Moderator
    Master

    Just store values in variables every time your event occurs and then you can calculate how many bars there have been since the last time it occurred.

    if (your event1) then
    myindex = barindex
    myprice = close
    endif
    
    barcount = barindex - myindex
    
    
    
    #119938 quote
    raibel
    Participant
    Junior
    thank you first … i will try it as soon as have time
    #120204 quote
    raibel
    Participant
    Junior

    no i don’t realy mean that. I must think about again …with more backwardthinking

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

Calculate bars distance from Point 1 to Point 2


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
raibel @raibel Participant
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by raibel
6 years ago.

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