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?