Your code should work as long as the variable total_profit is assigned the correct value
As you don't show how this variable is given a value, we are clueless.
Your code should work as long as the variable total_profit is assigned the correct value
As you don't show how this variable is given a value, we are clueless.
The code of total_profit I thought is unnecessary, but here is it:
close_order_profit=OrderProfit() + OrderSwap() + OrderCommission(); total_profit=total_profit+close_order_profit; //and after this code comes infowindow_upper=DoubleToString(total_profit,2); ObjectSetString(ChartID(),"profit_usd",OBJPROP_TEXT,infowindow_upper);
The total_profit and rest of the code is working. My problem is not to give value to the total_profit variable, but this variable as chart text is not working if I change timeframe of the chart. Example:
the EA is running on a chart with TF H1. I change TF to H4 or M30 (it makes no difference) I will see 0. The 0 is the start value of total_profit. If I change back to TF H1 I will see the right value of total_profit on the chart.
i tried the code with ChartRedraw, but not works.
The code of total_profit I thought is unnecessary, but here is it:
The total_profit and rest of the code is working. My problem is not to give value to the total_profit variable, but this variable as chart text is not working if I change timeframe of the chart. Example:
the EA is running on a chart with TF H1. I change TF to H4 or M30 (it makes no difference) I will see 0. The 0 is the start value of total_profit. If I change back to TF H1 I will see the right value of total_profit on the chart.
i tried the code with ChartRedraw, but not works.
Your code does not retrieve a certain value
close_order_profit=OrderProfit() + OrderSwap() + OrderCommission(); total_profit=total_profit+close_order_profit;
There is no loop.
No order is selected.
We have no idea whether the variables are declared locally or global-scope
Your code does not retrieve a certain value
There is no loop.
No order is selected.
We have no idea whether the variables are declared locally or global-scope
GumRai, why are you asking the loop and order selected code, because of the chart objects problem? This loop and orderselect are working good.
I have problem with charts object and refreshing them with
ObjectSetString
GumRai, why are you asking the loop and order selected code, because of the chart objects problem? This loop and orderselect are working good.
I have problem with charts object and refreshing them with
Hi,
I have a problem. If I change the timeframe on a chart with EA running, the object what my EA writes stay unchanged. I like the write on the chart example the profit. After TF change the profit write refresh doesn't work, I see example 0 if the start profit was 0.
Here is my code from my EA:
For me is not clear wich is better to use: ObjectSetString or ObjectSetText?
With the code above the "profit" will change on chart, BUT after I change the timeframe, the text stay unchanged and not refreshed if "profit" changes. Need I use ChartRedraw? I tried, but not lead to success.
Thanks for helping.
May be reading the reference about ObjectSetString(..) = "The function sets the value of the corresponding object property. ..." and
ObjectSetText(..) = "The function changes the object description" would have helped you to clarify the difference?
I guess one can be seen on the chart the other not..?
May be reading the reference about ObjectSetString(..) = "The function sets the value of the corresponding objectproperty. ..." and
ObjectSetText(..) = "The function changesthe object description" would have helped you to clarify the difference?
I guess one can be seen on the chart the other not..?
1) ChartID() gives you the ChartID of the current chart. Check (Comment(ChartId()) if it changes if you change the timeframe..?
2) Can it be that your Objects hasn't any different information to display if you change the timeframe? Add _Periods to find out.. ?
Why?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I have a problem. If I change the timeframe on a chart with EA running, the object what my EA writes stay unchanged. I like the write on the chart example the profit. After TF change the profit write refresh doesn't work, I see example 0 if the start profit was 0.
Here is my code from my EA:
For me is not clear wich is better to use: ObjectSetString or ObjectSetText?
With the code above the "profit" will change on chart, BUT after I change the timeframe, the text stay unchanged and not refreshed if "profit" changes. Need I use ChartRedraw? I tried, but not lead to success.
Thanks for helping.