how to check previous bar AccountFreeMargin

 

Anyone has a clue about how to check the previous bar AccountFreeMargin ?

It is working well to avoid trading twice on a bar for now using the following:

if((AccountFreeMargin()/AccountEquity())>=0.99)NoPositions=true;
else NoPositions=false;

but I cant figure out how to have the same for the previous bar because I dont want the system to open a trade on bar T and then on the next bar T+1 right away.

I have tried the following:

if((AccountFreeMargin()/AccountEquity())>=0.99)NoPreviousPositions=true;
else NoPreviousPositions=false;

but obviously it is not working......

can somebody help ?

thx and regards,

Movingaverage

 

AccountFreeMargin() provides current value only.

If you want to know past value, there are two choices:

1. Going forward, collect values you will want to reference in the future, and store them (easier)

2. Calculate past values by examining trade history (more difficult)

 
phy wrote >>

AccountFreeMargin() provides current value only.

If you want to know past value, there are two choices:

1. Going forward, collect values you will want to reference in the future, and store them (easier)

2. Calculate past values by examining trade history (more difficult)

Thx for your help Phy.

Reason: