some issues with my indicator

string PatternText[5000]; for(int j = 0; j < Bars; j++){ PatternText[j] = "pattern-" + j; }
PatternText[] are constants can be done in init. When Bars exceeds 5000, exceeding array bounds.extern bool Display_Buy = true; if(Display_Sell == true)
if (true==true) is redundant. if(Display_Sell)..ObjectCreate(PatternText[shift], OBJ_TEXT, 0, Time[shift], High[shift] + Range*0.5);
Once created, the object exists and create fails - the object is NOT moved. After a new bar is created you create object Pattern-1 identical to Pattern-0. You never delete the original. Don't use shift in object names, Time[shift] is unique.void TLine( string name, datetime T0, double P0, datetime T1, double P1 , color clr, bool ray=false ){ #define WINDOW_MAIN 0 if (!Show.Objects) return; /**/ if(ObjectMove( name, 0, T0, P0 )) ObjectMove(name, 1, T1, P1); else if(!ObjectCreate( name, OBJ_TREND, WINDOW_MAIN, T0, P0, T1, P1 )) Alert("ObjectCreate(",name,",TREND) failed: ", GetLastError() ); else if (!ObjectSet( name, OBJPROP_RAY, ray )) Alert("ObjectSet(", name, ",Ray) failed: ", GetLastError()); if (!ObjectSet(name, OBJPROP_COLOR, clr )) // Allow color change Alert("ObjectSet(", name, ",Color) [2] failed: ", GetLastError()); string P0t = PriceToStr(P0); if (MathAbs(P0 - P1) >= Point) P0t = StringConcatenate(P0t, " to ", PriceToStr(P1)); if (!ObjectSetText(name, P0t, 10)) Alert("ObjectSetText(",name,") [2] failed: ", GetLastError()); } void HLine(string name, double P0, color clr){ // #define WINDOW_MAIN 0 if (!Show.Objects) return; /**/ if (ObjectMove( name, 0, Time[0], P0 )){} else if(!ObjectCreate( name, OBJ_HLINE, WINDOW_MAIN, Time[0], P0 )) Alert("ObjectCreate(",name,",HLINE) failed: ", GetLastError() ); if (!ObjectSet(name, OBJPROP_COLOR, clr )) // Allow color change Alert("ObjectSet(", name, ",Color) [1] failed: ", GetLastError() ); if (!ObjectSetText(name, PriceToStr(P0), 10)) Alert("ObjectSetText(",name,") [1] failed: ", GetLastError()); }
Well first of all thank's for your help.
I still i don't get the void thing.
So you said don't use shift in object names ( Time[shift] ) then you wrote
void TLine( string name, datetime T0, double P0, datetime T1, double P1, color clr, bool ray=false )
Since the object creation is inside the cycle for(), how can i not use something like shift to determine the datetime T0 and datetime T1?
And i dont get the part where you write
string P0t = PriceToStr(P0); if (MathAbs(P0 - P1) >= Point) P0t = StringConcatenate(P0t, " to ", PriceToStr(P1));
What does stringconcatenate does ??
sory for my lack of knowledge.
and once again thank's for helping
- Since the object creation is inside the cycle for(), how can i not use something like shift to determine the datetime T0 and datetime T1?You were using names line Pattern-1, Pattern-2. The 1 and 2 was the shift. I didn't say you couldn't use "Pattern-"+Time[shift].
- What does stringconcatenate does ??

RTFM
WHRoeder:
Once again thank you
- Since the object creation is inside the cycle for(), how can i not use something like shift to determine the datetime T0 and datetime T1?You were using names line Pattern-1, Pattern-2. The 1 and 2 was the shift. I didn't say you couldn't use "Pattern-"+Time[shift].
- What does stringconcatenate does ??
RTFM
Hi!
Since last week i've been trying to develop an indicator to tell me when to enter/close trades, to give an idea of how much profit /loss the trade was and the total profit of all trades.
So far I not doing bad but i have some issues. Here's the script:
My main problems are:
-> Everytime a new bar opens all the alerts are shown again. Is it possible to just show when the entry or close position occur?
-> When i start the platform the labels are all mixed up and i have to go to the indicator and switch something so every number goes to the right position. why is this hapening?
-> The profit part is wrong and one of the main reasons is because i cant get the Bid/Ask price of that bar. Is it possible to know that?
Thanks