renatmt5: By the way, there is another thing about the protection you added. Since I have a delay of 1-2 minutes before the correct value is calculated, during which the variables are equal to zero, I switch the current timeframe to another one for quick update - the values are immediately recalculated. Probably, it is possible to make some software crutch on this principle?
I hate the word 'crutch'.
I've already thought of everything beforehand and it's very good that you asked. We need to turn LastProfitForPeriod from void into bool. If there is an error - for example, the date is not found or something else, we return false and so on.
I've already thought of everything beforehand and it's very good that you asked. We need to turn LastProfitForPeriod from void into bool. If there is an error - for example, the date is not found or something else, we return false and so on.
Thus, there will be no loss of minutes.
About "crutch" - yes, there is some careless attitude to programming in this word :)
Yes, the lost minute effect is gone in v.3 of the script.
I have added a block to calculate the time offset in relation to the closing of the last transaction. When trying to use last_time and n for line offset later on, I get a compile-time error :(
When creating ObjectCreate (chart_ID,name,OBJ_VLINE,sub_window,time,0), I need to change time from TimeCurrent() tolast_time with an offset to the future by a period equal to n. Or maybe there is a function that shifts an object forward/backward by specified number of bars? What is better? I confess that so far my independent efforts have been unsuccessful :(
renatmt5: When creating ObjectCreate (chart_ID,name,OBJ_VLINE,sub_window,time,0), I want to change time value so it would not be TimeCurrent(), butlast_time with an offset for the period equal to n. Or maybe there is a function that shifts an object forward/backward by specified number of bars? What is better? I confess that so far my independent efforts have been unsuccessful :(
Do I understand correctly that I need to make changes in the last line of the code snippet (time=0 in particular)?
//+------------------------------------------------------------------+ //| Move the vertical line | //+------------------------------------------------------------------+ bool VLineMove(constlong chart_ID=0, // chart's ID conststring name="VLine", // line name datetime time=0) // line time
Or VLineMove is a function, which still needs to be initiated in some place (e.g. in OnCalculate) and pass the incoming parameters to it? I'm completely confused :)
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
By the way, there is another thing about the protection you added. Since I have a delay of 1-2 minutes before the correct value is calculated, during which the variables are equal to zero, I switch the current timeframe to another one for quick update - the values are immediately recalculated. Probably, it is possible to make some software crutch on this principle?
I hate the word 'crutch'.
I've already thought of everything beforehand and it's very good that you asked. We need to turn LastProfitForPeriod from void into bool. If there is an error - for example, the date is not found or something else, we return false and so on.
Thus, there will be no loss of minutes.
If you get "false", reset the time:
Version 1.003
I hate the word 'crutch'.
I've already thought of everything beforehand and it's very good that you asked. We need to turn LastProfitForPeriod from void into bool. If there is an error - for example, the date is not found or something else, we return false and so on.
Thus, there will be no loss of minutes.
About "crutch" - yes, there is some careless attitude to programming in this word :)
Yes, the lost minute effect is gone in v.3 of the script.
As for "crutch" - yes, there is some careless attitude to programming in that word :)
Yes, the lost minute effect is gone in v.3 of the script.
It's an indicator:)
It's an indicator:)
Yes, that's right - still getting confused.
I have added a block to calculate the time offset in relation to the closing of the last transaction. When trying to use last_time and n for line offset later on, I get a compile-time error :(
..... { last_time=deal_time; profit_last_deal=full_profit; } } } } //-------------// // MY CODE // //-------------// if (profit_last_day<=0 && profit_last_deal<=0){uint n=60*60*24;} else if (profit_last_day>0 && profit_last_deal<=0){uint n=60*60*2;} else {uint n=60*60*1;} //-------------// // MY CODE END // //-------------// return(true); } .......Or maybe there is a function that shifts an object forward/backward by specified number of bars? What is better? I confess that so far my independent efforts have been unsuccessful :(
When creating ObjectCreate (chart_ID,name,OBJ_VLINE,sub_window,time,0), I want to change time value so it would not be TimeCurrent(), butlast_time with an offset for the period equal to n.
Or maybe there is a function that shifts an object forward/backward by specified number of bars? What is better? I confess that so far my independent efforts have been unsuccessful :(
The line is created once - in OnInit().
Then it is only moved -VLineMove
Do I understand correctly that I need to make changes in the last line of the code snippet (time=0 in particular)?
Or VLineMove is a function, which still needs to be initiated in some place (e.g. in OnCalculate) and pass the incoming parameters to it?
I'm completely confused :)