#propertyindicator_separate_window //— set the maximum and minimum values for the indicator window #propertyindicator_minimum 0 #propertyindicator_maximum 100 //— display two horizontal levels in a separate indicator window #property indicator_level1 25 #property indicator_level2 75 //— set thickness of horizontal levels #propertyindicator_levelwidth 1 //— set style of horizontal levels #propertyindicator_levelstyleSTYLE_DOT //+——————————————————————+ //| Custom indicator initialization function | //+——————————————————————+ intOnInit() { //— two levels IndicatorSetInteger(INDICATOR_LEVELS,2); //— set descriptions of horizontal levels IndicatorSetString(INDICATOR_LEVELTEXT,0,“First Level (index 0)”); IndicatorSetString(INDICATOR_LEVELTEXT,1,“Second Level (index 1)”); //— set the short name for indicator IndicatorSetString(INDICATOR_SHORTNAME,“IndicatorSetDouble() Demo”); //— set clrBlue color for all levels IndicatorSetInteger(INDICATOR_LEVELCOLOR,0,clrBlue); //— return(INIT_SUCCEEDED); } //+——————————————————————+ //| Custom indicator iteration function | //+——————————————————————+ intOnCalculate(constint rates_total, constint prev_calculated, constdatetime &time[], constdouble &open[], constdouble &high[], constdouble &low[], constdouble &close[], constlong &tick_volume[], constlong &volume[], constint &spread[]) { staticint tick_counter=0; staticdouble level1=25,level2=75; staticint delta=1; //— calculate ticks tick_counter+=delta; //— check ranges if(tick_counter<0) delta=5; if(tick_counter>25) delta=-5; //— calculate new values level1+=delta; level2-=delta; //— set new values for levels IndicatorSetDouble(INDICATOR_LEVELVALUE,0,level1); IndicatorSetDouble(INDICATOR_LEVELVALUE,1,level2); //— return value of prev_calculated for next call return(rates_total); }