How to perform a loop in a specific month to account for closed operations?
-
Does anyone have any idea how I can perform a Loop to save the final result of the sum of operations that were completed?
-
Can you not just take current balance - starting balance?
-
@jstapI did this, I always save the balance for each new 1-month candle and calculate the value of this variable - the value of the current balance, but I don't think it's the most effective way.
What I thought of is creating variables for:
January, February, March, April and so on each month in sequence until December.
Once this is done, I maintain loops saving the results of the respective months and with this all unify my management that I already have created which analyzes each individual trade observing the results of the previous month to make a break even (daily) and (monthly).Therefore, I would set a target in monthly % for profit or a monthly limit in % for loss based on the previous month, if in a set of the last 3 months I have a gain greater than 10% for example I could set another lock to reduce the lots, or increase them, in short, my management is complex and requires me to separately obtain the profit result month by month.
-
Example:
% Annual profit or loss: 21% ( this is a sum of profit and loss of all months). Update in real time.
January: 3%
February: -2%
March: -3%
April:3%
May: 4%
June: 5%
July:-10%
August: 5%
September: 6%
October: -5%
November: 8%
December: 7%Monthly Break Even Rule = If the sum of previous Months is positive at a certain specified value, then place a Break Even at 50%, always protecting Profit in the current month.
Daily Break Even Rule = If the sum of previous days is positive by a certain specified value, then place a Break Even at 50%, always protecting the Profit on the current day.
If the protection (Monthly Break Even) is triggered, resume operations the following month.
If the protection (daily Break Even) is triggered, operate again the next day.