Then I make a decision at the end of the strategy based on how many e.g. "G" or " R" in the last 12 CandleSticks. It is not working.
Right now I initialize the Array with "S" in the Variables Region like this
string[] TrackArr ={"S","S","S","S","S","S","S","S","S","S","S","S"} ;
Then I push the contents of each cell of the array to the back like this at the start of One Bar Update() like this using this for loop
for (int i=0; i <= TrackArr.Length-2; i++)
{
TrackArr[i+1]=TrackArr[i];
}
Then I make an If decision on the array and Stuff "G","S","W" or " R" into the first cell that should now be unoccupied like this TrackArr[0]="G" as an example.
When I add up all the "G" 's in the Array of 12 cells, I get crazy stuff, 0 or 12 , when likely should be uniformly 2 thru 10 as a count.
What am I doing wrong? What is doing?
Is there a easier, better way? Maybe Create a indicator and call the indicator?
Comment