Serving Traders Since 2005
|
|
|
|||||||
| MetaTrader Indicators Post and discuss the MetaTrader indicators here. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
I can't say much without seeing a screenshot, but I see 2 potential problems in your code:
1. If you call that code in OnCalculate() function then you create an object each tick. Do you delete it each tick? It's better to create it only once and then only change the displayed value. 2. You have a variable containing current CCI value and the object with the same name - myCCInow. Ideally that shouldn't be a problem, but maybe it's the cause? |
|
||||
|
Quote:
... return(rates_total); ... line. Works now properly as far as I see it. |
|
||||
|
I think that you can greatly reduce the indicator's load by placing this part of the code in the OnInit() function:
ObjectCreate(0, "myCCInow", OBJ_LABEL, 0, 0, 0); ObjectSetString(0, "myCCInow", OBJPROP_FONT, font_face); ObjectSetInteger(0, "myCCInow", OBJPROP_FONTSIZE, font_size); ObjectSetInteger(0, "myCCInow", OBJPROP_COLOR, White); ObjectSetInteger(0, "myCCInow", OBJPROP_CORNER, corner); ObjectSetInteger(0, "myCCInow", OBJPROP_XDISTANCE, 1+distance_x); ObjectSetInteger(0, "myCCInow", OBJPROP_YDISTANCE, 1+distance_y); And this one leave in the OnCalculate(): ObjectSetString(0, "myCCInow", OBJPROP_TEXT,"CCI @ "+DoubleToString(myCCInow,1)); |
|
||||
|
Quote:
Yes, you are right, this is even better. Thanks. |
|
||||
|
Yes, why not?
__________________
Please, read the Forum Rules and the Signature Rules to avoid termination of your account. |
|
||||
|
Thanks for the reply
I tried a multitimeframeversion of this indicator my code is as follows Quote:
Is there a mistake in my code? |
|
||||
|
I don't know but the second check on myCCInow in the end is unnecessary. Do you see any errors in the Experts log output?
__________________
Please, read the Forum Rules and the Signature Rules to avoid termination of your account. |
![]() |
| Bookmarks |
| Tags |
| arrows, cci, cross, indicator, metatrader |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|