I would like to arrange the following
With an initial capital of 100%, the 1.Trade should make 1% profit to 101% of the initial capital.
If the first trade is negative, the 2nd trade should make a profit of 101% of the initial capital
If the second trade goes into the red, the 3rd trade should make a profit of 101% of the initial capital.
and so on to
until is 101% achieved.
Then it starts all over again, with a target of 102% of the starting capital.
From what I can see, it’s a ordersize problem.
How do I program it best?
Try this one (I tested it just for syntax errors):
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
JohnScher – Topic moved to ProOrder forum as it is a strategy question and not a general discussion. Please try to follow the forum rules and post in the correct place with future posts.