dimanche 5 février 2017

Daily Loss Limit

Dear Friends,,

I want to implement an afl code to find Daily Loss Limit in intraday trading. I will use the code for backtesting around 200 days.
I have the following code, but it has serious mistakes.

Code:

// identify new day
dn = DateNum();
newDay = dn != Ref( dn,-1);

// Daily Loss Limit
dll = Optimize("dll", 0, 5, 10000, 5 );

EquityCount = 10000;

for( i = 0; i < BarCount; i++ )

// signals
Buy  =  ....;
Sell =  ....;

diff = (Equity(1) - Ref(Equity(1), -1));
EquityCount = EquityCount + diff;

// allow only dll
Buy = Buy AND EquityCount > dll;
}

Any help will be appreciated.
Thanks.


Daily Loss Limit

Aucun commentaire:

Enregistrer un commentaire