////////////////////////////////////////////////////////////////////////
// Gestion de la taille des lots (avec réinvestissement)
////////////////////////////////////////////////////////////////////////
ONCE LotManagement = 1 //1=enable LOT size management
ONCE MyCapital = 10000 //10000 Capital invested
ONCE MinLots = 1 //1 min lots
ONCE MaxLots = 999 //999 max lots
ONCE InitialSize = 1
ONCE LotSize = InitialSize
NT = (OnMarket AND Not OnMarket[1]) OR (LongOnMarket AND ShortOnMarket[1]) OR (LongOnMarket[1] AND ShortOnMarket)
IF LotManagement AND (Not OnMarket OR NT) THEN
MyEquity = MyCapital + StrategyProfit
MyInvestment = MyEquity / MyCapital
TempLot = floor(InitialSize * MyInvestment,1)
LotSize = min(MaxLots,max(MinLots,TempLot))
ENDIF
////////////////////////////////////////////////////////////////////////
// Exemple de stratégie
//
if close crosses over average[100,0](close) and not onmarket THEN
buy LotSize contracts at market
elsif close crosses under average[100,0](close) and not onmarket THEN
sellshort LotSize contracts at market
endif
set target pprofit 300
set stop ploss 100
graph LotSize