How to store the result of last 6 trades

 
I want to decide the risklevel by the last 6 win/loss. My codes do not work. Can someone help to check the codes?

My idea is:

// set up 7 boxes to store the result of the last 6 trades
int box0=0;
int box1=0;
int box2=0;
int box3=0;
int box4=0;
int box5=0;
int box6=0;

int risklevel=0

// if last trade wins, box0 =1
if ( OrderProfit() > 0 )
box0=1;

// if last trade loses, box0 = 0
if ( OrderProfit() < 0 )
box0=0;

// shift one space to store new value
box6=box5;
box5=box4;
box4=box3;
box3=box2;
box2=box1;
box1=box0;

// add up the value of the 6 boxes to see how many wins and losses
risklevel = box1 + box2 + box3 + box4 + box5 + box6;

// decide risklevel, risklevel = 0-6 ...
 

Vwrestler

Arrays would be more practical, see this article for the full story


'Considering Orders in a Large Program'


Good Luck

-BB-

Reason: