NexusFi: Find Your Edge


Home Menu

 





Referencing existing historic data points


Discussion in TradeStation

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




 
Search this Thread

Referencing existing historic data points

  #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?
ZombieSqueeze
Platforms and Indicators
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Better Renko Gaps
The Elite Circle
About a successful futures trader who didn´t know anyth …
Psychology and Money Management
 
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

TheCocunut,

welcome to futures.io. 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 Twitter 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


© 2024 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 - Privacy Policy - Downloads - Top
no new posts