DEFPARAM CumulateOrders = false
ONCE BasePerCent = 101 //101% initial target
ONCE MyCapital = 10000 //initial capital
ONCE MinLot = 1 //Minimum lot size
ONCE LotSize = MinLot //initially set to Minimun Lot Size (it will increase later)
IF Not OnMarket THEN
MyEquity = MyCapital + STRATEGYPROFIT
IF MyEquity > MyCapital THEN
IF MyEquity >= (MyCapital * BasePerCent / 100) THEN
BasePerCent = BasePerCent + 1
LotSize = MinLot
ENDIF
ELSIF MyEquity < MyEquity[1] THEN
Difference = MyEquity[1] / MyEquity
IF MyEquity < MyCapital THEN
LotSize = Lotsize * Difference
ENDIF
ENDIF
ELSE
IF (PositionPerf * 100) >= 1 THEN //when 1% is reached while at market, add 1% to the initial target
BasePerCent = BasePerCent + 1
ENDIF
ENDIF
IF close CROSSES OVER average[200] then
buy LotSize Contracts AT Market
ENDIF
IF close CROSSES UNDER average[200] then
sellshort LotSize Contracts AT Market
ENDIF
set target pprofit 300
set stop ploss 100
//
//graph StrategyProfit
//graph MyEquity
//graph Difference
//graph LotSize
//graph BasePerCent