Objects to redraw

 
Hi.

The file attached is another pivot point indicator.

I´m working in a modification of the code from another one to look like in some particular way.

Everything works Ok if you want to use.

But, I added labels (objects) to the lines of pivot, support and resistance to a better description (ie: pivot 1.2936).

The problem is: a movement in price is needed to redraw all objects when you move between TF´s.

If somebody could share an idea about to fix that it would be great.
Files:
 
Use function ObjectsRedraw to immediately redrawing.
 
Rosh:
Use function ObjectsRedraw to i Immediately redrawing.


Thanks Rosh

I made several attempts with ObjectsRedraw but I can´t get it work.

Sure I´m doing something wrong.

Could you take a look at the code and tell me where and how include the new lines.

There is no much information about that function.

Thanks again.
 
Change your code a little:

      {
      double P =  (PreviousHigh+PreviousLow+PreviousClose)/3;
      double R1 = (2*P)-PreviousLow;
      double S1 = (2*P)-PreviousHigh;
      double R2 =  P+(PreviousHigh - PreviousLow);
      double S2 =  P-(PreviousHigh - PreviousLow);
      double R3 = (2*P)+(PreviousHigh-(2*PreviousLow));
      double S3 = (2*P)-((2* PreviousHigh)-PreviousLow); 
      
      LabelShiftTime = Time[LabelShift];
      if (i==0)
         {
         Print(i);
         ObjectCreate("Pivot", OBJ_TEXT, 0, LabelShiftTime, 0);   
         ObjectSetText("Pivot", "                           Pivot " +DoubleToStr(P,4),fontsize,"tahoma ",PivotLabelColor);
         SetIndexLabel(0, "Pivot Point");
         ObjectCreate("Sup1", OBJ_TEXT, 0, LabelShiftTime, 0);
         ObjectSetText("Sup1", "                    S1 " +DoubleToStr(S1,4),fontsize,"tahoma ",SupportLabelColor);
         SetIndexLabel(1, "S1");
         ObjectCreate("Res1", OBJ_TEXT, 0, LabelShiftTime, 0);
         ObjectSetText("Res1", "                    R1 " +DoubleToStr(R1,4),fontsize,"tahoma ",ResistanceLabelColor);
         SetIndexLabel(2, "R1");
         ObjectCreate("Sup2", OBJ_TEXT, 0, LabelShiftTime, 0);
         ObjectSetText("Sup2", "                    S2 " +DoubleToStr(S2,4),fontsize,"tahoma ",SupportLabelColor);
         SetIndexLabel(3, "S2");
         ObjectCreate("Res2", OBJ_TEXT, 0, LabelShiftTime, 0);
         ObjectSetText("Res2", "                    R2 " +DoubleToStr(R2,4),fontsize,"tahoma ",ResistanceLabelColor);
         SetIndexLabel(4, "R2");
         ObjectCreate("Sup3", OBJ_TEXT, 0, LabelShiftTime, 0);
         ObjectSetText("Sup3", "                    S3 " +DoubleToStr(S3,4),fontsize,"tahoma ",SupportLabelColor);
         SetIndexLabel(5, "S3");
         ObjectCreate("Res3", OBJ_TEXT, 0, LabelShiftTime, 0);
         ObjectSetText("Res3", "                    R3 " +DoubleToStr(R3,4),fontsize,"tahoma ",ResistanceLabelColor);
         SetIndexLabel(6, "R3");
         Print("ObjectSet Done");
         ObjectMove("Res3", 0, LabelShiftTime,R3);
         ObjectMove("Res2", 0, LabelShiftTime,R2);
         ObjectMove("Res1", 0, LabelShiftTime,R1);
         ObjectMove("Pivot", 0, LabelShiftTime,P);
         ObjectMove("Sup1", 0, LabelShiftTime,S1);
         ObjectMove("Sup2", 0, LabelShiftTime,S2);
         ObjectMove("Sup3", 0, LabelShiftTime,S3);
         Print("ObjectMove Done");
      
         ObjectsRedraw(); 
         Print("ObjectsRedraw Done");
         }
There was number useless movings of Objects on Every bar (in initial counting).
 
Incredible Rosh.

You´re the man :)

Attached is the fixed version.

Thanks a lot
 
See also Obsolete functions


In further development of MQL4, some functions were renamed and moved from one group to another in order to systematize them better. The old function names are not highlighted or linked to the MetaEditor Dictionary. The old function names can be used since the compiler will accept them in a proper way. However, we strongly recommend to use the new names.

Old Name New Name
BarsPerWindowWindowBarsPerChart
ClientTerminalNameTerminalName
CurTimeTimeCurrent
CompanyNameTerminalCompany
FirstVisibleBarWindowFirstVisibleBar
HighestiHighest
HistoryTotalOrdersHistoryTotal
LocalTimeTimeLocal
LowestiLowest
PriceOnDroppedWindowPriceOnDropped
ScreenShotWindowScreenShot
ServerAddressAccountServer
TimeOnDroppedWindowTimeOnDropped
Reason: