[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Dynamically change PositionSize



PureBytes Links

Trading Reference Links

I'm trying to change the PositionSize for a futures backtest (for 
spreadbetting). I'd like the position size to be dependent on the 
distance between the buy order and initial stop loss for each trade.

The code I have here doesn't seem to work:

if( Status("action") == actionPortfolio ) 
{ 
    bo = GetBacktesterObject(); 

    bo.Backtest(1); // run default backtest procedure 

    for( sig = bo.GetFirstSignal(); sig; sig = bo.GetNextSignal() ) 
     { 
        if( sig.IsEntry() ) 
         { 
          // handle entry signal 
		sig.posSize = 5000; /// This would change according to 
rules
         }   
     }
    bo.ListTrades(); 
}




Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.28/672 - Release Date: 2/6/2007 10:22 AM