Daily strategy profit
Forums › ProRealTime English forum › ProBuilder support › Daily strategy profit
- This topic has 5 replies, 2 voices, and was last updated 7 years ago by Juan Salas.
-
-
11/09/2017 at 11:27 AM #52089
Hi colleagues,
Is there any way to measure the daily strategy profit of one code?? I would like to limit the daily operations to a certain strategy profit per day.
I thought that including a daily reseting paragraph would do it:
1234// STRATEGYPROFIT per day. It resets the variable each new dayIF INTRADAYBARINDEX = 0 THENstratprofit = 0ENDIFIs that even possible?? Any coding suggestions or links will be welcome
Thanks in advance
Juan
11/09/2017 at 11:33 AM #52093I would suggest:
123456789// STRATEGYPROFIT per day. It resets the variable each new dayIF INTRADAYBARINDEX = 0 THENstratprofit = STRATEGYPROFIT //save the previous day ProfitENDIFIF (STRATEGYPROFIT - stratprofit) >= .... THEN //This will tell you current day's profit/loss...ENDIF11/09/2017 at 11:37 AM #52094Hi Roberto,
It seems a very good solution. Many thanks for your help and your prompt response.
Juan
11/09/2017 at 8:43 PM #52174Hi Roberto,
This is part of the code where I have translated the info you gave me. I want to trade daily until either I get the daily profit of 20 pips or daily loss of 20 pips. After one of these two are achieved, I would like to stop operations until next day. DEFPARAM Flatbefore and Flatafter are set for 060000 and 200000.
I don’t know if you can measure strategy profit in pips or have to due in currency.
Thanks again,
12345678910111213141516171819202122232425262728293031323334353637// ONE TRADE PER DAY. It resets the variable each new dayIF INTRADAYBARINDEX = 0 THENnomoretrade = 0ENDIF// STRATEGYPROFIT per day. It resets the variable each new dayIF INTRADAYBARINDEX = 0 THENstratprofit = STRATEGYPROFIT //save the previous day ProfitENDIF// LONG Positions-Opening// AlcistasIF NOT LONGONMARKET AND cambiotendenciaalza AND nomoretrade = 0 THENBUY positionsize CONTRACT AT MARKETSET TARGET pPROFIT profit3ENDIF// SHORT Positions-Opening// BajistasIF NOT SHORTONMARKET AND vela10bajista AND nomoretrade = 0 THENSELLSHORT positionsize CONTRACT AT MARKETSET TARGET pPROFIT profit1ENDIF// Finishing DAILY operations when reaching target profit/lossIF (STRATEGYPROFIT-stratprofit)>=20*pipsize THEN //current day's profitSELL AT MARKETEXITSHORT AT MARKETnomoretrade = 1ENDIFIF (STRATEGYPROFIT-stratprofit)<=-20*pipsize THEN //current day's lossSELL AT MARKETEXITSHORT AT MARKETnomoretrade = 1ENDIF11/09/2017 at 10:43 PM #52180STRATEGYPROFIT only deals with money (https://www.prorealcode.com/topic/strategyprofit/#post-51298).
I think lines 27 and 33 are wrong, since the expression
120*pipsizewill convert Pips to price, i.e. DAX will be converted to 20 (unchanged due to the fact that Dax is over 10000 and has no decimal digits), EurUsd to 0.0020. Both of them have nothing to do with profit/loss.
With DAX it’s pretty easy to convert Euros into Pips, since each Pip is 25 euros (or 1 for mini contracts), so if you have Euro 750 profit it equals 30 pips. AS for currency pairs and other instruments it could not be as straightforward!
I have no knowledge of a way to work it out easily.
11/09/2017 at 11:01 PM #52184Hi Roberto,
Thanks. I got it. I like to monitor and control daily results and this piece of code is going to be very useful for my future coding.
Grazie mille,
Juan
-
AuthorPosts
Find exclusive trading pro-tools on