Confusing about the TradeIndex

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #191507 quote
    JSJS
    Participant
    Master

    Suppose I buy 1 contract on BarIndex = 1000 and I sell this contract on BarIndex = 2000

    And I buy 1 contract on BarIndex =3000 and I sell this contract on BarIndex = 4000

    What is the value of:

    TradeIndex(1)

    TradeIndex(2)

    TradeIndex(3)

    TradeIndex(4)

    Etc…

    #191508 quote
    robertogozzirobertogozzi
    Moderator
    Legend
    Appending these lines to any strategy  might help:
    Graph BarIndex
    Graph TradeIndex(1)
    Graph TradeIndex(2)
    Graph TradeIndex(3)
    Graph TradeIndex(4)
    #191509 quote
    JSJS
    Participant
    Master

    Thanks Roberto,

    I had done that, but I couldn’t place the results well:

    TradeIndex(0) = 0

    TradeIndex = TradeIndex(1) = 4001

    TradeIndex(2) = 3001

    TradeIndex(3) = 2001

    TradeIndex(4) = 1001

    TradeIndex(5) = 0

    #191515 quote
    robertogozzirobertogozzi
    Moderator
    Legend
    TradeIndex is the BarIndex when either a trade is a) opened, b) closed. At every new operation the TradeIndex is shifted one place. If it’s a Stop & Reverse (exit followed by a new open), two places are shifted and both the Exit of the previous trade and the open of the new one share the same BarIndex, despite they will have a different TradeIndex ID due to the sequential occurrences. The 4 attached pics should make it clear what the process is like.
    JS and Nicolas thanked this post
    Pic1-before-the-very-first-trade.jpg Pic1-before-the-very-first-trade.jpg Pic2-first-Stop-Reverse.jpg Pic2-first-Stop-Reverse.jpg Pic3-first-exit-no-S-R.jpg Pic3-first-exit-no-S-R.jpg Pic4-Not-OnMarket.jpg Pic4-Not-OnMarket.jpg
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Confusing about the TradeIndex


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
JS @js Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/09/2022
Status: Active
Attachments: 4 files
ProRealCode ProRealCode
Loading...