Strategyprofit on fixed tp
Forums › ProRealTime English forum › ProOrder support › Strategyprofit on fixed tp
- This topic has 31 replies, 4 voices, and was last updated 1 year ago by JohnScher.
-
-
01/07/2023 at 2:50 PM #207000
Strategyprofit again
Maybe the question is already answered and someone can answer me with a link to it?
Question is.
Every trade I win should increase my capital in 1%.
If I lose a trade, the next trade should increase my capital by a total of 2%. If I lose the next trade, the next trade should increase my capital by a total of 3%, and so on until I win a trade. If this is the 4th trade that wins, I then have 104% capital and this should then be set to 100% capital and game starts again.
So far so good and for the cracks here certainly no problem.But now, how does it look if I work with a fixed TakeProfit from trade with 1.5% and only with a time stop?
Here now the quite simple strategy in which the Strategy-Proft problem could be integrated.late noon trade123456789101112131415161718192021222324//-------------------------------------------------------// late noon trade// instrument dax40// timezone europe, berlin// timeframe 30m// created and coded by JohnScher//-------------------------------------------------------defparam cumulateorders = falsedefparam flatafter = 213000once ordersize = 1td = opendayofweek >= 1 and opendayofweek <= 6tt = time = 133000c = close > exponentialaverage [6] (close)if td and tt and c thenbuy ordersize contracts at marketendifset target %profit 1.5pls can anyone help?
see attached the itf-file01/09/2023 at 7:14 AM #207093What is the starting Capital you want to use for 1 lot?
1 user thanked author for this post.
01/14/2023 at 1:11 PM #207438Well, hi, Roberto.
Currently, unfortunately, I do not have so much time for PRT. I am sorry that I can only answer today. So here let´s go.
Starting Capital = 10.000
One addition/change perhaps still.
Since the TakeProfit is not reached every time because of the TimeStop, this would have to be taken into account.
Means therefore
If a trade is won with 50 points after time stop ,
New Startcapital= 10.050 = 100.5%
This NewCapital is then set to 100% for the further calculations
NewStartcapital = 10,050 = 100%
(Starting Capital = 10.000 = 100%
Gain after TimeStop = +50 pointsize
New Startcapital = 10.050 = 100%)If a trade is lost, the next trade should reach the target of 1.5% calculated from the all-time high of the starting capital.
Therefore, the correct stake size must be calculated in order to achieve the take profit of the StartingCapital of 1.5% + all-time high from Starting Capital when the take profit of the trade is reached.Example
oldStartCapital = 10.000
Profit trade = +50 points
newStartCapital = 10.050
next Trade = Losstrade =-100 points
newStartCapital= 9.950Calculate the postionsize if reach the TakeProfit of the trade = 1.5% of the price = reach the TakeProfit of the all time high of the starting capital (= 10,050 ) +1% of the starting capital.
the target new starting capital would be 10.050 + 10.050*0,01 = 10.150,5It is complicated. Do you understand what I mean?
01/14/2023 at 1:17 PM #20743901/20/2023 at 5:57 PM #207785There you go:
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152//-------------------------------------------------------// late noon trade// instrument dax40// timezone europe, berlin// timeframe 30m// created and coded by JohnScher//-------------------------------------------------------defparam cumulateorders = false//defparam flatafter = 213000once Capital = 10000once Equity = Capitalonce SizeRatio = 1once MinSize = 1 //minimum lot size allowed (it can be lower, if the broker allows decimals)once PipGain = 50 * PipSizeonce CapitalInc = Capital / 200 //0.5% increaseonce ordersize = Equity * SizeRatio / Capitalonce TradeLost = 0IF TradeLost = 0 THENIF Time >= 213000 THENSELL AT MarketENDIFENDIFtd = opendayofweek >= 1 and opendayofweek <= 6tt = time = 133000c = close > exponentialaverage[6](close)myProfit = (StrategyProfit - StrategyProfit[1]) / PipValueIF myProfit > 0 THENTradeLost = 0ENDIFIF myProfit >= PipGain THENEquity = Equity + CapitalIncordersize = Equity * SizeRatio / CapitalELSIF myProfit < 0 THENTradeLost = 1Equity = Equity + (myProfit * PipValue)ENDIFMaxEquity = max(MaxEquity,Equity) //not sure about the ALL-time highest Equity and 1.5%if td and tt and c thenLotSize = max(MinSize,floor(ordersize,2))buy LotSize contracts at marketendifset target %profit 1.5//graph TradeLost//graph myProfit >= PipGain coloured("Red")//graph OrderSizeI couldn’t fully understand the 1.5% and the all-time highest capital requirements, so I did not add them. Can you explain better with some examples?
2 users thanked author for this post.
01/21/2023 at 1:44 PM #207824Hello Roberto.
Thank you very much for your work.
I would also like to take this opportunity to say a big thank you for standing by me and helping me so many times. Thank you!Once again for understanding. I try to express myself better.
It should apply in general to all strategies and be examined on the example of the late-noon-trade.
We have a time-based stop. This means we do not always reach the specified StopLoss and TargetProfit.
Nevertheless, we have SL and TP.Let’s program the FinanceMangement, piece by piece.
We start from the initial capital of 10,000 euros.
Step 1
We win a trade.
Now the (new) starting capital should be = 10.000 Euro + the profit from the last trade.Simple?
Send it back as a code.oki?
1 user thanked author for this post.
01/29/2023 at 3:15 PM #208673I am attaching the new version according to yourlast request.
2 users thanked author for this post.
02/05/2023 at 5:20 PM #20914812345678910111213141516171819202122232425<span class="Y2IQFc" lang="en">Thank you very much for your work.I didn't get around to looking at it sooner, I was on the way on other battlefields. I'm sorry, I should appreciate your work even more.If you want to answer that, please take your time. The strategy is important for all my systems to check. There is no rush, it does not depend on one day or the other.Better let's talk so we don't talk past each other.What I saw above doesn't quite match what I want. I probably didn't express myself correctly (the sender is responsible for the receiver understanding the signals)So, I want to try again, using the late noon trade as an example.Starting capital = 10.000 = 100%We start a 1st trade.The goal is a 1% profit from the starting capital - if the TakeProfits of the trade (!) (=1.5% of the index level) is reached.Because of the TimeStop, the trade will not always end in the SL or TP, of course.Therefore we act as follows.If the new starting capital is greater than the old (first) starting capital after the first trade, the (new) starting capital becomes the old starting capital.If after the 2nd trade the new starting capital is greater than the previous starting capital, the new starting capital becomes the old starting capital and so one .... so far, so clear.And now the problem, it's going a bit in the direction of Martingale.If the new starting capital is smaller than the old starting capital after the 1st trade, we want to calculate how large our positons (possibiliy in fractions) is so that we receive this 1% profit from the (old) starting capitalAs long as the following trades are lost, I would like to keep recalculating how many positions (possibly in fractions) I have to trade in order to reach this 1% of the (first - later from the old) starting capital.We do this everry until the new starting capital has finally reached 101% of the old starting capital after (many) lost trades.Difficult Birth. I hope you understand... im sorry, ask me</span>02/07/2023 at 4:14 PM #209311I put your algo live. One trade so far, one winner but unfortunately no further trades although one appears every day in the backtest ??? It makes me doubt that there are live problems ??
02/11/2023 at 3:24 PM #209536I could not yet deal with Roberto’s changes, so many things are also to do. A big thanks to Roberto who works tirelessly like a machine.
The original trade approach runs live with me. ordersize halfpoint for control purposes. No problems. The same almost like in demo.
1 user thanked author for this post.
02/19/2023 at 1:07 PM #209952Hello Roberto
or maybe someone else can help.I have simplified the code and changed onetime. Because it is not about maximization. He looks like this now.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647//-------------------------------------------------------// late noon trade// instrument dax40// timezone europe, berlin// timeframe 30m// created and coded by JohnScher//-------------------------------------------------------defparam cumulateorders = falsedefparam flatafter = 213000once Capital = 10000once Equity = Capitalonce CapitalInc = Equitiy / 200 //0.5% increaseonce ordersize = 1once TradeLost = 0td = opendayofweek >= 1 and opendayofweek <= 6tt = time = 133000c = close > exponentialaverage[6](close)myProfit = (StrategyProfit - StrategyProfit[1]) / PipValueIF myProfit > 0 THENTradeLost = 0Equity = Equity + myProfitELSIF myProfit < 0 THENTradeLost = 1ENDIFif td and tt and c thenIf tradelost = 0 thenlotsize = ordersizeElsif tradelost = 1 thenLotsize = ??????????????? // here is the problembuy LotSize contracts at marketEndifEndifset target %profit 1.5The intended calculation of the order size seems clearer now.
If the last trade was won, the order size = 1.
If the last trade was lost, the order size should be calculated in such a way,
that the TakeProfit of the trade = 1.5% and when this TakeProfit is reached, the new Eqitity should be Equitiy[1] + Capitalincr*pipsize.Can the code be created for this?
1 user thanked author for this post.
02/22/2023 at 5:26 PM #210157hello Roberto
do you already have a plan for John’s problem, would also be very interested to find out how it works????02/23/2023 at 3:23 PM #210282Actually I don’t know what to do, I can’t find any calculation method when a trade is lost. How can 1.5% TP be reached if the trade was lost?
2 users thanked author for this post.
02/23/2023 at 4:21 PM #210298How can 1.5% TP be reached if the trade was lost?
For the next trade to come.
02/23/2023 at 4:41 PM #210306My problem was that there was only one trade and nothing happened for weeks (several trades were displayed in the backtest for the period), I closed it yesterday at PRT and immediately restarted it and today there was another trade that was still there is running, I’m curious what happens and if it starts trading again ??
-
AuthorPosts
Find exclusive trading pro-tools on