Page 1 of 1

Coding Question on the TRO_RAT_ZONE Indicator

Posted: Fri Mar 29, 2019 2:34 pm
by Techguy
TRO: this is your modified TRO_RAT_ZONE indicator...
(or anyone else that knows the answer...)

I noted that the deinit() function got called in the init() function.
Am I missing something here? or is this a typo? Is there some diabolical bug, or advantage in MT4 that requires deinit() to be called in the init() function? See the line just before the return value.

I hadn't seen this before...

Thanks

Code: Select all

//+------------------------------------------------------------------+
int init()
  {
//---- indicators

   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,myWingDing);
   SetIndexBuffer(0,DynR);
   SetIndexEmptyValue(0,0.0);
   
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,myWingDing);
   SetIndexBuffer(1,DynS);
   SetIndexEmptyValue(1,0.0);
   
   SetIndexStyle(2,DRAW_ARROW);
   SetIndexArrow(2,myWingDing);
   SetIndexBuffer(2,LgTrig);
   SetIndexEmptyValue(2,0.0);
   
   SetIndexStyle(3,DRAW_ARROW);
   SetIndexArrow(3,myWingDing);
   SetIndexBuffer(3,ShTrig);
   SetIndexEmptyValue(3,0.0);
 
   SetIndexStyle(4,DRAW_ARROW);
   SetIndexArrow(4,myWingDing);
   SetIndexBuffer(4,BOTarget);
   SetIndexEmptyValue(4,0.0);
     
   
   period       = Period(); 
   tChartPeriod =  TimeFrameToString(period) ;
   symbol       =  Symbol() ;   
   digits       =  Digits ;   
   Trigger      =  Time[0] ; 
   point        =  Point ;
   
   if(digits == 5 || digits == 3) { digits = digits - 1 ; point = point * 10 ; } 

   xThreshold  = iThreshold * point ;

   PipsTrigger = iPipsTrigger * point ;
   
   ShortName    =  TAG+symbol+iPeriods ;


if( myCorner == 0 || myCorner == 2 )

   x001 = 0 ;
   x002 = 0 ;
   x003 = 90 ;
   x004 = 150;
   x005 = 100 ;
   x006 = 10 ; 
   x007 = 0 ;
   FillAmt = 20 ;     
}
else
{
   x001 = 0 ;
   x002 = 10 ; // 
   x003 = 60 ;  // val 
   x004 = 0 ; //  dif
   x005 = 0 ;
   x006 = 10 ; 
   x007 = 220 ;  // arrow
   FillAmt = 23 ;
}

   BreakOutPips = iBreakOutPips * point ;
     
   deinit() ;
 
   return(0);
  }


Thanks

ooops TRO Rat Zone not sweetspot.

Re: Coding Question on the TRO_RAT_ZONE Indicator

Posted: Fri Mar 29, 2019 5:35 pm
by TheRumpledOne
Techguy wrote:TRO: this is your modified TRO_RAT_ZONE indicator...
(or anyone else that knows the answer...)

I noted that the deinit() function got called in the init() function.
Am I missing something here? or is this a typo? Is there some diabolical bug, or advantage in MT4 that requires deinit() to be called in the init() function? See the line just before the return value.


I do that to make sure everything starts "fresh". For example, deleting objects on the screen.

Re: Coding Question on the TRO_RAT_ZONE Indicator

Posted: Sat Mar 30, 2019 7:10 pm
by Techguy
[/quote] I do that to make sure everything starts "fresh". For example, deleting objects on the screen.[/quote]

OK, I think I get it.

Thanks!

Re: Coding Question on the TRO_RAT_ZONE Indicator

Posted: Mon Jan 06, 2020 8:01 am
by alvinnash
Thank you!

Re: Coding Question on the TRO_RAT_ZONE Indicator

Posted: Thu Jan 09, 2020 5:06 am
by niketsurve
Good information.

Re: Coding Question on the TRO_RAT_ZONE Indicator

Posted: Mon Sep 28, 2020 1:46 am
by patsm00re18
Thanks for this information.

Re: Coding Question on the TRO_RAT_ZONE Indicator

Posted: Mon Oct 12, 2020 8:34 am
by Astinzz
Great article.