Max Lost per day
Forums › ProRealTime English forum › ProOrder support › Max Lost per day
- This topic has 17 replies, 5 voices, and was last updated 1 year ago by ZeroCafeine.
-
-
05/03/2023 at 12:07 PM #214057
Hi everyone,
The idea is simple and here are the rules :
– Counting losses per day
– If my loss is more than 10 per day then I stop trading for the day
– If my loss is more than 40 per week then I stop trading for the week1234567891011121314151617181920212223IF IntraDayBarIndex = 0 THENLastStrategyProfit = StrategyProfit // Store last value of StrategyProfitENDIFDayProfit = StrategyProfit - LastStrategyProfitIF Day = 1 THENMondayProfit = DayProfitELSIF Day = 2 THENTuesdayProfit = DayProfitELSIF Day = 3 THENWednesdayProfit = DayProfitELSIF Day = 4 THENThursdayProfit = DayProfitELSIF Day = 5 THENFridayProfit = DayProfitELSIF Day = 7 THENMondayProfit = 0TuesdayProfit = 0WednesdayProfit = 0ThursdayProfit = 0FridayProfit = 0ENDIF05/03/2023 at 12:11 PM #214059So you are calculating the loss in money and creating condition upon all these variables? Can you share an example for reference and for the benefit of other users please? 😉
1 user thanked author for this post.
05/03/2023 at 11:31 PM #214098The aim is to integrate the rules on this code, We will call this idea of Money management idea B, you can participate or propose another idea on this post
maybe we can create a boolen TradeOnOff for use it as a filter, somethink like this :
1234567IF DayProfit < (-1)*10 THENTradeOnOff = 0ENDIFIf LongCondition AND TradeOnOff ThenBuy 1 Shares AT MarketENDIFI’m not sure how to do this, if you have any ideas or links on the forum
lest say this named rules :
A: Counting losses per day
B: If my loss is more than 10 per day then I stop trading for the day
C: If my loss is more than 40 per week then I stop trading for the week
D: If my loss is more than 100 I stop trading for hole monthE: We will also try to keep track of the winnings, and why not add a small part of the winnings to allow us to bet more
05/04/2023 at 9:29 AM #214110for the B rule I think this boolen as a condition is ok :
1DayLostCondition = DayProfit > -10for the C rule I think this boolen as a condition is ok :
123WeekProfit = MondayProfit + TuesdayProfit + WednesdayProfit + ThursdayProfit + FridayProfitWeekLostCondition = WeekProfit > -40and for buy condition we have to test this both boolen with buy condition like this :
123IF LongSignal AND DayLostCondition AND WeekLostCondition THENBuy 1 Shares AT MarketENDIFwhat do you think ? and if some one can help for count week losses for add the D rule ?
tks in advance for any help or link
05/04/2023 at 9:53 AM #214112I correct myself for the DayOfWeek function, is there a function to retrieve the current week or do you have to divide the DayOfWeek function by 7 ?
1234567891011121314151617IF DayOfWeek = 1 THENMondayProfit = DayProfitELSIF DayOfWeek = 2 THENTuesdayProfit = DayProfitELSIF DayOfWeek = 3 THENWednesdayProfit = DayProfitELSIF DayOfWeek = 4 THENThursdayProfit = DayProfitELSIF DayOfWeek = 5 THENFridayProfit = DayProfitELSIF DayOfWeek = 6 THENMondayProfit = 0TuesdayProfit = 0WednesdayProfit = 0ThursdayProfit = 0FridayProfit = 0ENDIFand does Sunday exist? DayOfWeek = 7 ?
05/04/2023 at 12:05 PM #214118https://www.prorealcode.com/documentation/currentdayofweek/
https://www.prorealcode.com/documentation/currentmonth/
https://www.prorealcode.com/documentation/category/dateandtime/
Strangely there isn’t listed CurrentWeek
I’m fairly sure Sunday = 0 and so Monday = 1 … etc
1 user thanked author for this post.
05/04/2023 at 2:12 PM #214122I see that I am asking too many questions 😅,
I just did a test on a market that is open all the time and yes, I can confirm that Sunday is 0 and Saturday is 6, you can see in the photo : Sunday = Dimanche
05/04/2023 at 2:17 PM #214124and yes they haven’t CurrentWeek or WeekOfMonth :
123Return CurrentWeekReturn WeekOfMonth1 user thanked author for this post.
05/05/2023 at 7:09 AM #214157Complete list is:
CurrentTime: Current HourMinuteSecond (the market one).
CurrentSecond: Current (market) second.
CurrentMinute: Current (market) minute.
CurrentHour: Current (market) hour.
CurrentMonth: Current month (the market one).
CurrentDayOfWeek: Current day of the week.
CurrentYear: Current year (that of the market).
Today:Date of the current day (that of the market)
Yesterday:Date of the previous day of the market.05/05/2023 at 7:59 AM #214159Tks you @Nicolas
How do we know which week of the year or which week of the month it is?
05/05/2023 at 8:09 AM #21416005/05/2023 at 9:04 AM #214163Tks you, and how to know which week in the month we are, exemple the first or second week of the month pls ?
05/05/2023 at 9:21 AM #21416805/05/2023 at 11:44 AM #214185I don’t have an answer yet, but I think with Nicolas’ answer there is a way to do something with maybe divisions and the Day function to know which week you are in the month or in the year
And Maybe you have an answer for me in this thread Link here
05/05/2023 at 11:46 AM #214186The first week of the year is week #1 and it is the one in which 4+ days belong to the new year (4, 5, 6 or 7, while 1, 2 or 3 is the last week of the prior year). From there on you start counting up to 52 (occasionally 53) weeks.
Some hints at https://www.prorealcode.com/topic/tomorrows-date/.
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on