NexusFi: Find Your Edge


Home Menu

 





Referencing existing historic data points


Discussion in TradeStation

Updated
    1. trending_up 1,625 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
TheCocunut
Seattle, WA
 
Posts: 2 since Oct 2022
Thanks Given: 1
Thanks Received: 0

I am a total newbie, so I'll apologize now if my question or premise is completely naïve. I've looked everywhere I can and I simply can't find an answer to this question.

Using a "ShowMe" study, I'm trying to plot points on past bars based on current conditions. Below is a snippet of code simplifying the concept.....

variables: IntrabarPersist iIndexSaved(0);

if someSpecificCondition() then iIndexSaved = CurrentBar;
if someAnotherCondition() then Plot1[CurrentBar - iIndexSaved](High[CurrentBar - iIndexSaved);

Even though I never actually reference a bar less than my current data stream, this code seems to run until "CurrentBar - iIndexSaved" is greater than "MaxBarsBack", then "MaxBarsBack" is changed to "CurrentBar - iIndexSaved" and the ShowMe is run over again from scratch. Since the re-run starts at bar number "MaxBarsBack", I don't have the data for the "someSpecificCondition" function to execute.


Here is actual code that should plot a line between the lowest low points between each high point.

Variables:
IntrabarPersist vHighIndex(0),
IntrabarPersist vLowIndex (0);

If High > High[CurrentBar - vHighIndex] Then Begin
vHighIndex = CurrentBar;
Plot2[CurrentBar - vLowIndex](CurrentBar - vLowIndex);
vLowIndex = CurrentBar;
End Else If Low < Low[CurrentBar - vLowIndex] Then Begin
vLowIndex = CurrentBar;
End;

Does this make sense?

Can anyone lend any insight?


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
requesting .nrd replay files from 2026 spy and qqq
The Elite Circle
Trump Media to sell instant access to market-moving soci …
Traders Hideout
No book, only a stair: journaling fills where price move …
Cryptocurrency
Datafeed for Atas
Platforms and Indicators
EA
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
BERN ALGOS algo trading journal
3 thanks
NexusFi site changelog and issues/problem reporting
2 thanks
TopStep Trader disappointment
2 thanks
Want your NinjaTrader indicator created, free?
1 thanks
Running trading strategies on a VPS
1 thanks
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643

TheCocunut,

welcome to NexusFi. This is expected behavior due to the way MaxBarsBack works within Tradestation.
In general, it is better to avoid looking back, if possible. For your case that could mean saving the High of the bar when your conditions are true.

If you must go back to that bar for that plot, you will have to accept this behavior. In that case using more historical data and allowing for large MaxBarsBack values
might be the way to go. Alternatively, you could use drawings for the display instead of a plot and not affect the max bars back value.

Regards,

ABCTG


TheCocunut View Post
I am a total newbie, so I'll apologize now if my question or premise is completely naïve. I've looked everywhere I can and I simply can't find an answer to this question.

Using a "ShowMe" study, I'm trying to plot points on past bars based on current conditions. Below is a snippet of code simplifying the concept.....

variables: IntrabarPersist iIndexSaved(0);

if someSpecificCondition() then iIndexSaved = CurrentBar;
if someAnotherCondition() then Plot1[CurrentBar - iIndexSaved](High[CurrentBar - iIndexSaved);

Even though I never actually reference a bar less than my current data stream, this code seems to run until "CurrentBar - iIndexSaved" is greater than "MaxBarsBack", then "MaxBarsBack" is changed to "CurrentBar - iIndexSaved" and the ShowMe is run over again from scratch. Since the re-run starts at bar number "MaxBarsBack", I don't have the data for the "someSpecificCondition" function to execute.


Here is actual code that should plot a line between the lowest low points between each high point.

Variables:
IntrabarPersist vHighIndex(0),
IntrabarPersist vLowIndex (0);

If High > High[CurrentBar - vHighIndex] Then Begin
vHighIndex = CurrentBar;
Plot2[CurrentBar - vLowIndex](CurrentBar - vLowIndex);
vLowIndex = CurrentBar;
End Else If Low < Low[CurrentBar - vLowIndex] Then Begin
vLowIndex = CurrentBar;
End;

Does this make sense?

Can anyone lend any insight?


Follow me on X Reply With Quote
Thanked by:
  #3 (permalink)
TheCocunut
Seattle, WA
 
Posts: 2 since Oct 2022
Thanks Given: 1
Thanks Received: 0


Thank you for the comment. Its good to know that this is a system feature and not a user mistake. I will find another way to accomplish what I am trying to do (such as Drawings as you recommended). Thank you!


Reply With Quote




Last Updated on October 12, 2022


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts