Forums › ProRealTime English forum › ProOrder support › Orders size problem with fixed straetegyprofitwinnings, pls give a hand › Reply To: Orders size problem with fixed straetegyprofitwinnings, pls give a hand
07/07/2020 at 5:49 PM
#138671
Try this one (I tested it just for syntax errors):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
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 |