xMeter

Minggu, 01 Januari 2012

Silakan Copy script Dibawah ini :

/*
xMeterMTF.mq4  
Copyright © 2007, MetaQuotes Software Corp.  
Price Meter System™ ©GPL  

Hartono Setiono
   5/17/2007 Redsigned based on xMeter_mini.mq4 indicator
*/

#property copyright "x Meter System™ ©GPL"
#property link      "forex-tsd dot com"
#property  indicator_chart_window
#property  indicator_buffers 0

#include <stdlib.mqh>
#include <stderror.mqh>

#define TABSIZE  10                     // scale of currency's power !!!DON'T CHANGE THIS NUMBER!!!
#define ORDER    2                      // available type of order !!!DON'T CHANGE THIS NUMBER!!!

extern bool AccountIsIBFXmini = false;
/*extern*/ bool LoopOnInit=false;

/* You can change any of the following arrays */
   string aTradePair[]= {"GBPJPY"};
   string aPair[]   = {"EURUSD","GBPUSD","AUDUSD","USDJPY","USDCHF","USDCAD",
                       "EURJPY","EURGBP","EURCHF","EURAUD","GBPJPY","GBPCHF"};
                     
/* The following can also be changed but both must have the same dimension */
   string aMajor[] = {"USD","EUR","GBP","CHF","CAD","AUD","JPY"};
   int    aMajorPos[] = {130, 110, 90, 70, 50, 30, 10};


string aOrder[ORDER]    = {"BUY ","SELL "};
int    aTable[TABSIZE]  = {0,3,10,25,40,50,60,75,90,97};                 // grade table for currency's power

int PairCount;
int CurrencyCount;
double aMeter[];
double aHigh[];
double aLow[];
double aBid[];
double aAsk[];
double aRatio[];
double aRange[];
double aLookup[];
double aStrength[];
int aIndex[2][];

//+------------------------------------------------------------------+
//     expert initialization function                                |    
//+------------------------------------------------------------------+
int init()
  {
   int err,lastError, ps;
   PairCount=ArrayRange(aPair,0);
   CurrencyCount=ArrayRange(aMajor,0);
   ps=ArrayRange(aMajorPos,0);
   if(CurrencyCount!=ps) Print("The size of array aMajor is not equals to aMajorPos");

   ArrayResize(aMeter,CurrencyCount);
   ArrayResize(aHigh,PairCount);
   ArrayResize(aLow,PairCount);
   ArrayResize(aBid,PairCount);
   ArrayResize(aAsk,PairCount);
   ArrayResize(aRatio,PairCount);
   ArrayResize(aRange,PairCount);
   ArrayResize(aLookup,PairCount);
   ArrayResize(aStrength,PairCount);
 
   init_tradepair_index();

//----
   initGraph();
   if (LoopOnInit)
   {
      while (true)                                                           // infinite loop for main program
      {
        if (IsConnected()) main();
        if (!IsConnected()) objectBlank();
        WindowRedraw();
        Sleep(1000);                                                          // give your PC a breath
      }
   }
//----
   return(0);                                                               // end of init function
  }
//+------------------------------------------------------------------+
//     expert deinitialization function                              |    
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectsDeleteAll(0,OBJ_LABEL);
   Print("shutdown error - ",ErrorDescription(GetLastError()));                               // system is detached from platform
//----
   return(0);                                                               // end of deinit function
  }
//+------------------------------------------------------------------+
//     expert start function                                         |    
//+------------------------------------------------------------------+
int start()
  {
//----
   if (!LoopOnInit) main();
//----
   return(0);                                                               // end of start funtion
  }
//+------------------------------------------------------------------+
//     expert custom function                                        |    
//+------------------------------------------------------------------+  
void main()                                                                 // this a control center
  {
//----
   double point;
   int    index, pindex, cnt;
   string mySymbol;
   double cmeter;
   
   for (index = 0; index < PairCount; index++)                                // initialize all pairs required value
   {
      RefreshRates();                                                       // refresh all currency's instrument
      if (AccountIsIBFXmini)
         mySymbol = aPair[index]+'m';                                       // Add "m for IBFX mini
      else
         mySymbol = aPair[index];                      
      point            = GetPoint(mySymbol);                                // get a point basis
      aHigh[index]     = MarketInfo(mySymbol,MODE_HIGH); //iHigh(mySymbol,mTimeFrame,iHighest(mySymbol,mTimeFrame,MODE_HIGH,mPeriod,0));   // find highest
      aLow[index]      = MarketInfo(mySymbol,MODE_LOW); //iLow(mySymbol,mTimeFrame,iLowest(mySymbol,mTimeFrame,MODE_LOW,mPeriod,0));   // find lowest
      aBid[index]      = MarketInfo(mySymbol,MODE_BID);                 // set a last bid
      aAsk[index]      = MarketInfo(mySymbol,MODE_ASK);                 // set a last ask
      aRange[index]    = MathMax((aHigh[index]-aLow[index])/point,1);       // calculate range today
      aRatio[index]    = (aBid[index]-aLow[index])/aRange[index]/point;     // calculate pair ratio
      aLookup[index]   = iLookup(aRatio[index]*100);                        // set a pair grade
      aStrength[index] = 9-aLookup[index];                                  // set a pair strengh
   }

   // calculate all currencies meter      
   for (pindex=0; pindex<CurrencyCount; pindex++)
   {
     cnt=0;
     cmeter=0;
     for (index = 0; index < PairCount; index++)                                // initialize all pairs required value
     {
       if (StringSubstr(aPair[index],0,3)==aMajor[pindex])
       {
        cnt++;
        cmeter = cmeter + aLookup[index];
       }
       if (StringSubstr(aPair[index],3,3)==aMajor[pindex])
       {
        cnt++;
        cmeter = cmeter + aStrength[index];
       }
       if (cnt>0) aMeter[pindex]=NormalizeDouble(cmeter / cnt,1); else aMeter[pindex]=-1;
     }
   }
           
   objectBlank();
 
   for (pindex=0; pindex<CurrencyCount; pindex++)
   {
     paintCurr(pindex, aMeter[pindex]);
   }
   paintLine();
                                                                         
//----
  }

void init_tradepair_index()
{
  int i,n,tpcount, m1index, m2index;
  string cpair, m1,m2;
  tpcount=ArraySize(aTradePair);

  for(n=0; n<tpcount; n++)
  {
    cpair=aTradePair[0];
    m1=StringSubstr(cpair,0,3);
    m2=StringSubstr(cpair,3,3);
    aIndex[0,n]=-1;
    aIndex[1,n]=-1;
    for(i=0;i<CurrencyCount;i++)
    {
      if(m1==aMajor[i]) aIndex[0,n]=i;
      if(m2==aMajor[i]) aIndex[1,n]=i;
    }
    if(aIndex[0,n]==-1 || aIndex[1,n]==-1)
      Print("Currency Pair : ",cpair," is not tradeable, check array definition!");
  }
}

string GetSymbol(string mSymbol)
{
  string RetSymbol;
  if (AccountIsIBFXmini) RetSymbol = mSymbol + "m"; else RetSymbol = mSymbol;  
  return (RetSymbol);
}

double GetPoint(string mSymbol)
{
 double myPoint = 0.0001, YenPoint = 0.01;
 string mySymbol;
 if (StringSubstr(mySymbol,3,3) == "JPY") return (YenPoint);
 return(myPoint);
}

int iLookup(double ratio)                                                   // this function will return a grade value
  {                                                                         // based on its power.
   int   index=-1, i;
 
   if      (ratio <= aTable[0]) index = 0;
   else {
     for (i=1; i<TABSIZE; i++) if(ratio < aTable[i]) {index=i-1;  break; }
     if(index==-1) index=9;
   }
   return(index);                                                           // end of iLookup function
  }

void initGraph()
  {
   int pindex;
   ObjectsDeleteAll(0,OBJ_LABEL);

   for (pindex=0; pindex<CurrencyCount; pindex++)
   {
   objectCreate(aMajor[pindex]+"_1",aMajorPos[pindex],43);
   objectCreate(aMajor[pindex]+"_2",aMajorPos[pindex],35);
   objectCreate(aMajor[pindex]+"_3",aMajorPos[pindex],27);
   objectCreate(aMajor[pindex]+"_4",aMajorPos[pindex],19);
   objectCreate(aMajor[pindex]+"_5",aMajorPos[pindex],11);
   objectCreate(aMajor[pindex],aMajorPos[pindex]+2,12,aMajor[pindex],7,"Arial Narrow",SkyBlue);
   objectCreate(aMajor[pindex]+"p",aMajorPos[pindex]+4,21,DoubleToStr(9,1),8,"Arial Narrow",Silver);
   }
 
   objectCreate("line",10,6,"-----------------------------------",10,"Arial",DimGray);
   objectCreate("line1",10,27,"-----------------------------------",10,"Arial",DimGray);
   objectCreate("line2",10,69,"-----------------------------------",10,"Arial",DimGray);
   objectCreate("sign",11,1,"»»» Price Meter System™ ©GPL «««",8,"Arial Narrow",DimGray);
   WindowRedraw();
  }
//+------------------------------------------------------------------+
void objectCreate(string name,int x,int y,string text="-",int size=42,
                  string font="Arial",color colour=CLR_NONE)
  {
   ObjectCreate(name,OBJ_LABEL,0,0,0);
   ObjectSet(name,OBJPROP_CORNER,3);
   ObjectSet(name,OBJPROP_COLOR,colour);
   ObjectSet(name,OBJPROP_XDISTANCE,x);
   ObjectSet(name,OBJPROP_YDISTANCE,y);
   ObjectSetText(name,text,size,font,colour);
  }

void objectBlank()
  {
   int pindex;
 
   for (pindex=0; pindex<CurrencyCount; pindex++)
   {
   ObjectSet(aMajor[pindex]+"_1",OBJPROP_COLOR,CLR_NONE);
   ObjectSet(aMajor[pindex]+"_2",OBJPROP_COLOR,CLR_NONE);
   ObjectSet(aMajor[pindex]+"_3",OBJPROP_COLOR,CLR_NONE);
   ObjectSet(aMajor[pindex]+"_4",OBJPROP_COLOR,CLR_NONE);
   ObjectSet(aMajor[pindex]+"_5",OBJPROP_COLOR,CLR_NONE);
   ObjectSet(aMajor[pindex],OBJPROP_COLOR,CLR_NONE);
   ObjectSet(aMajor[pindex]+"p",OBJPROP_COLOR,CLR_NONE);
   }

   ObjectSet("line1",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("line2",OBJPROP_COLOR,CLR_NONE);
  }

void paintCurr(int pindex, double value)
{
  if (value > 0) ObjectSet(aMajor[pindex]+"_5",OBJPROP_COLOR,Red);
  if (value > 2) ObjectSet(aMajor[pindex]+"_4",OBJPROP_COLOR,Orange);
  if (value > 4) ObjectSet(aMajor[pindex]+"_3",OBJPROP_COLOR,Gold);
  if (value > 6) ObjectSet(aMajor[pindex]+"_2",OBJPROP_COLOR,YellowGreen);
  if (value > 7) ObjectSet(aMajor[pindex]+"_1",OBJPROP_COLOR,Lime);
  ObjectSet(aMajor[pindex],OBJPROP_COLOR,SkyBlue);
  ObjectSetText(aMajor[pindex]+"p",DoubleToStr(value,1),8,"Arial Narrow",Silver);
}

void paintLine()
  {
   ObjectSet("line1",OBJPROP_COLOR,DimGray);
   ObjectSet("line2",OBJPROP_COLOR,DimGray);
  }
Read more >>

Multi_Lot_Scalper

Silakan Copy script Dibawah ini :



//+------------------------------------------------------------------+
//|                                Multi_Lot_Scalper(10points 3).mq4 |
//|                              Copyright © 2005, Alejandro Galindo |
//|                                              http://elCactus.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, Alejandro Galindo"
#property link      "http://elCactus.com"
//----
extern double TakeProfit = 40;
extern double Lots = 0.1;
extern double InitialStop = 0;
extern double TrailingStop = 20;
extern int MaxTrades = 10;
extern int Pips = 15;
extern int SecureProfit = 10;
extern int AccountProtection = 1;
extern int OrderstoProtect = 3;
extern int ReverseCondition = 0;
extern double EURUSDPipValue = 10;
extern double GBPUSDPipValue = 10;
extern double USDCHFPipValue = 10;
extern double USDJPYPipValue = 9.715;
extern int StartYear = 2005;
extern int StartMonth = 1;
extern int EndYear = 2006;
extern int EndMonth = 12;
extern int EndHour = 22;
extern int EndMinute = 30;
extern int mm = 0;
extern int risk = 12;
extern int AccountisNormal = 0;
//----
int  OpenOrders = 0, cnt = 0;
int  slippage = 5;
double sl = 0, tp = 0;
double BuyPrice = 0, SellPrice = 0;
double lotsi = 0, mylotsi = 0;
int mode = 0, myOrderType = 0;
bool ContinueOpening = True;
double LastPrice = 0;
int  PreviousOpenOrders = 0;
double Profit = 0;
int LastTicket = 0, LastType = 0;
double LastClosePrice = 0, LastLots = 0;
double Pivot = 0;
double PipValue = 0;
string text = "", text2 = "";
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   if(AccountisNormal == 1)
     if(mm != 0)
         lotsi = MathCeil(AccountBalance()*risk/10000);
    else
        lotsi=Lots;
   else
       // then is mini
       if(mm != 0)
           lotsi = MathCeil(AccountBalance()*risk / 10000) / 10;
    else
        lotsi = Lots;
//----
   if(lotsi > 100)
       lotsi = 100;
   OpenOrders = 0;
//----
   for(cnt = 0; cnt < OrdersTotal(); cnt++)  
     {
       OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
     //----
       if(OrderSymbol() == Symbol())
        OpenOrders++;
     }      
//----
   if(OpenOrders < 1)
     {
     if(TimeYear(CurTime()) < StartYear)
         return(0);
     //----
       if(TimeMonth(CurTime()) < StartMonth)
         return(0);
     //----
       if(TimeYear(CurTime()) > EndYear)
         return(0);
     //----
       if(TimeMonth(CurTime()) > EndMonth )
         return(0);
     }
//----
   if(Symbol() == "EURUSD")
       PipValue = EURUSDPipValue;
//----
   if(Symbol() == "GBPUSD")
       PipValue = GBPUSDPipValue;
//----
   if(Symbol() == "USDJPY")
       PipValue = USDJPYPipValue;
//----
   if(Symbol() == "USDCHF")
       PipValue = USDCHFPipValue;
//----
   if(PipValue == 0)
     {
       PipValue = 5;
     }
//----
   if(PreviousOpenOrders > OpenOrders)
     for(cnt = OrdersTotal(); cnt >= 0; cnt--)
       {
         OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
        mode = OrderType();
        //----
           if(OrderSymbol() == Symbol())
          {
           if(mode == OP_BUY)
               OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), slippage, Blue);
           //----
               if(mode == OP_SELL)
               OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), slippage, Red);
           return(0);
          }
       }
   PreviousOpenOrders = OpenOrders;
//----
   if(OpenOrders >= MaxTrades)
     ContinueOpening = False;
   else
     ContinueOpening = True;
//----
   if(LastPrice == 0)
     for(cnt = 0; cnt < OrdersTotal(); cnt++)
       {
         OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
        mode = OrderType();
        //----
           if(OrderSymbol() == Symbol())
          {
           LastPrice = OrderOpenPrice();
           //----
               if(mode == OP_BUY)
               myOrderType = 2;
           //----
               if(mode == OP_SELL)
               myOrderType = 1;
          }
       }
//----
   if(OpenOrders < 1)
     {
     myOrderType = 3;
     //----
       if(iMACD(NULL, 0, 14, 26, 9, PRICE_CLOSE, MODE_MAIN, 0) >
        iMACD(NULL, 0, 14, 26, 9, PRICE_CLOSE, MODE_MAIN, 1))
         myOrderType = 2;
     //----
       if(iMACD(NULL, 0, 14, 26, 9, PRICE_CLOSE, MODE_MAIN, 0) <
        iMACD(NULL,0,14,26,9,PRICE_CLOSE, MODE_MAIN, 1))
         myOrderType = 1;
     //----
       if(ReverseCondition == 1)
        if(myOrderType == 1)
            myOrderType = 2;
        else
            if(myOrderType == 2)
                myOrderType=1;
     }
   // if we have opened positions we take care of them
   for(cnt = OrdersTotal(); cnt >= 0; cnt--)
     {
       OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
     //----
       if(OrderSymbol() == Symbol())
       {
        if(OrderType() == OP_SELL)
           if(TrailingStop > 0)
              if(OrderOpenPrice() - Ask >= (TrailingStop + Pips)*Point)
                 if(OrderStopLoss() > (Ask + Point*TrailingStop))
                   {
                     OrderModify(OrderTicket(), OrderOpenPrice(),
                                 Ask + Point*TrailingStop, OrderClosePrice() -
                                 TakeProfit*Point - TrailingStop*Point, 800, Purple);
                    return(0);  
                   }
        if(OrderType() == OP_BUY)
           if(TrailingStop > 0)
               if(Bid - OrderOpenPrice() >= (TrailingStop + Pips)*Point)
                 if(OrderStopLoss() < (Bid - Point*TrailingStop))
                   {  
                     OrderModify(OrderTicket(), OrderOpenPrice(),
                                 Bid - Point*TrailingStop, OrderClosePrice() +
                                 TakeProfit*Point + TrailingStop*Point, 800, Yellow);
                           return(0);
                   }
        }
     }
   Profit = 0;
   LastTicket = 0;
   LastType = 0;
 LastClosePrice = 0;
 LastLots = 0;
//----
 for(cnt = 0; cnt < OrdersTotal(); cnt++)
   {
     OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
     //----
       if(OrderSymbol() == Symbol())
       {
        LastTicket = OrderTicket();
       //----
           if(OrderType() == OP_BUY)
           LastType = OP_BUY;
       //----
           if(OrderType() == OP_SELL)
           LastType = OP_SELL;
       LastClosePrice = OrderClosePrice();
       LastLots = OrderLots();
       //----
           if(LastType == OP_BUY)
         {
          if(OrderClosePrice() < OrderOpenPrice())
             Profit = Profit - (OrderOpenPrice() - OrderClosePrice())*OrderLots() /
                      Point;
          //----
               if(OrderClosePrice() > OrderOpenPrice())
             Profit = Profit + (OrderClosePrice() - OrderOpenPrice())*OrderLots() /
                      Point;
         }
       //----
           if(LastType==OP_SELL)
         {
          if(OrderClosePrice() > OrderOpenPrice())
             Profit = Profit - (OrderClosePrice() - OrderOpenPrice())*OrderLots() /
                      Point;
          //----
               if(OrderClosePrice() < OrderOpenPrice())
             Profit = Profit + (OrderOpenPrice() - OrderClosePrice())*OrderLots() /
                      Point;
         }
       }
     }
 Profit = Profit*PipValue;
 text2 = "Profit: $" + DoubleToStr(Profit,2) + " +/-";
//----
   if(OpenOrders >= (MaxTrades - OrderstoProtect) && AccountProtection == 1)
     if(Profit >= SecureProfit)
       {
         OrderClose(LastTicket, LastLots, LastClosePrice, slippage, Yellow);
         ContinueOpening = False;
         return(0);
       }
//----
   if(!IsTesting())
     {
     if(myOrderType == 3)
         text="No conditions to open trades";
     else
         text="                         ";
     Comment("LastPrice=", LastPrice, " Previous open orders=", PreviousOpenOrders,
             "\nContinue opening=", ContinueOpening, " OrderType=", myOrderType, "\n",
             text2, "\nLots=", lotsi, "\n", text);
     }
//----
   if(myOrderType == 1 && ContinueOpening)
     {
       if((Bid - LastPrice) >= Pips*Point || OpenOrders < 1)
         {
           SellPrice = Bid;
           LastPrice = 0;
           //----
           if(TakeProfit == 0)
               tp = 0;
           else
               tp = SellPrice - TakeProfit*Point;
           //----
           if(InitialStop == 0)
               sl = 0;
           else
               sl = SellPrice + InitialStop*Point;
           //----
           if(OpenOrders != 0)
             {
               mylotsi = lotsi;
               //----
               for(cnt = 1; cnt <= OpenOrders; cnt++)
                 if(MaxTrades > 12)
                     mylotsi = NormalizeDouble(mylotsi*1.5, 1);
                 else
                     mylotsi = NormalizeDouble(mylotsi*2, 1);
          }
        else
            mylotsi=lotsi;
        //----
           if(mylotsi > 100)
            mylotsi = 100;
        OrderSend(Symbol(), OP_SELL, mylotsi, SellPrice, slippage, sl, tp, NULL, 0, 0,
                  Red);      
        return(0);
       }
     }    
   if(myOrderType == 2 && ContinueOpening)
     {
       if((LastPrice-Ask) >= Pips*Point || OpenOrders < 1)
         {
           BuyPrice = Ask;
           LastPrice = 0;
           //----
           if(TakeProfit == 0)
               tp = 0;
           else
               tp = BuyPrice + TakeProfit*Point;
           //----
           if(InitialStop==0)
               sl = 0;
           else
               sl = BuyPrice - InitialStop*Point;
           //----
           if(OpenOrders != 0)
             {
               mylotsi = lotsi;
               for(cnt = 1; cnt <= OpenOrders; cnt++)
                 if(MaxTrades > 12)
                     mylotsi = NormalizeDouble(mylotsi*1.5, 1);
                 else
                     mylotsi = NormalizeDouble(mylotsi*2, 1);
             }
           else
               mylotsi = lotsi;
           //----
           if(mylotsi > 100)
               mylotsi = 100;
           OrderSend(Symbol(), OP_BUY, mylotsi, BuyPrice, slippage, sl, tp, NULL, 0, 0,
                     Blue);  
           return(0);
         }
     }  
//----
   return(0);
  }
//+------------------------------------------------------------------+
Read more >>

Super_Trend

Silakan Copy script di bawah ini:



//+------------------------------------------------------------------+
//|                                              SuperTrend.mq4 v1.2 |
//|                   Copyright © 2008, Jason Robinson (jnrtrading). |
//|                                   http://www.spreadtrade2win.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, Jason Robinson."
#property link      "http://www.spreadtrade2win.com"

#property indicator_chart_window
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_width1 2
#property indicator_width2 2
#property indicator_buffers 2
double TrendUp[], TrendDown[];
int changeOfTrend;
extern int Nbr_Periods = 10;
extern double Multiplier = 3.0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexBuffer(0, TrendUp);
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexLabel(0, "Trend Up");
   SetIndexBuffer(1, TrendDown);
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexLabel(1, "Trend Down");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
 
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int limit, i, flag, flagh, trend[5000];
   double up[5000], dn[5000], medianPrice, atr;
   int counted_bars = IndicatorCounted();
//---- check for possible errors
   if(counted_bars < 0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars > 0) counted_bars--;
   limit=Bars-counted_bars;
   //Print(limit);
 
//----
   for (i = Bars; i >= 0; i--) {
      TrendUp[i] = EMPTY_VALUE;
      TrendDown[i] = EMPTY_VALUE;
      atr = iATR(NULL, 0, Nbr_Periods, i);
      //Print("atr: "+atr[i]);
      medianPrice = (High[i]+Low[i])/2;
      //Print("medianPrice: "+medianPrice[i]);
      up[i]=medianPrice+(Multiplier*atr);
      //Print("up: "+up[i]);
      dn[i]=medianPrice-(Multiplier*atr);
      //Print("dn: "+dn[i]);
      trend[i]=1;
 
     
      if (Close[i]>up[i+1]) {
         trend[i]=1;
         if (trend[i+1] == -1) changeOfTrend = 1;
         //Print("trend: "+trend[i]);
       
      }
      else if (Close[i]<dn[i+1]) {
         trend[i]=-1;
         if (trend[i+1] == 1) changeOfTrend = 1;
         //Print("trend: "+trend[i]);
      }
      else if (trend[i+1]==1) {
         trend[i]=1;
         changeOfTrend = 0;      
      }
      else if (trend[i+1]==-1) {
         trend[i]=-1;
         changeOfTrend = 0;
      }

      if (trend[i]<0 && trend[i+1]>0) {
         flag=1;
         //Print("flag: "+flag);
      }
      else {
         flag=0;
         //Print("flagh: "+flag);
      }
     
      if (trend[i]>0 && trend[i+1]<0) {
         flagh=1;
         //Print("flagh: "+flagh);
      }
      else {
         flagh=0;
         //Print("flagh: "+flagh);
      }
     
      if (trend[i]>0 && dn[i]<dn[i+1])
         dn[i]=dn[i+1];
     
      if (trend[i]<0 && up[i]>up[i+1])
         up[i]=up[i+1];
     
      if (flag==1)
         up[i]=medianPrice+(Multiplier*atr);
       
      if (flagh==1)
         dn[i]=medianPrice-(Multiplier*atr);
       
      //-- Draw the indicator
      if (trend[i]==1) {
         TrendUp[i]=dn[i];
         if (changeOfTrend == 1) {
            TrendUp[i+1] = TrendDown[i+1];
            changeOfTrend = 0;
         }
      }
      else if (trend[i]==-1) {
         TrendDown[i]=up[i];
         if (changeOfTrend == 1) {
            TrendDown[i+1] = TrendUp[i+1];
            changeOfTrend = 0;
         }
      }
   }
   WindowRedraw();
     
//----
   return(0);
  }
//+------------------------------------------------------------------+
Read more >>

AutoFib_TradeZones

 Silakan Copy script Dibawah ini :



//---------------------------------------------+
//                          AutoFib TradeZones |
//         © 2010 Eagleye777, www.fxtools.info |
//           *Mod of AutoFibo by Julien Loutre |
//                           www.forexcomm.com |
//---------------------------------------------+
#property link "http://www.fxtools.info"
#property  indicator_chart_window
#property indicator_buffers  2
#property  indicator_color1  MidnightBlue
#property  indicator_color2  FireBrick

extern int Fib_Period = 240;
extern bool Show_StartLine = false;
extern bool Show_EndLine = false;
extern bool Show_Channel = false;
extern int Fib_Style = 5;
extern color Fib_Color = Gold;
extern color StartLine_Color = RoyalBlue;
extern color EndLine_Color = FireBrick;
extern color BuyZone_Color = MidnightBlue;
extern color SellZone_Color = FireBrick;

//---- buffers
double WWBuffer1[];
double WWBuffer2[];

double level_array[10]={0,0.236,0.382,0.5,0.618,0.764,1,1.618,2.618,4.236};
string leveldesc_array[13]={"0","23.6%","38.2%","50%","61.8%","76.4%","100%","161.8%","261.80%","423.6%"};
int level_count;
string level_name;
string StartLine = "Start Line";
string EndLine = "End Line";

int init() {
   IndicatorBuffers(2);
if (Show_Channel)
   {
   SetIndexStyle(0,DRAW_LINE,1);
   SetIndexStyle(1,DRAW_LINE,1);
 
   SetIndexLabel(0, "High");
   SetIndexLabel(1, "Low");
 
   SetIndexBuffer(0, WWBuffer1);
   SetIndexBuffer(1, WWBuffer2);
   }
   IndicatorDigits(Digits+2);
 
   IndicatorShortName("AutoFib TradeZones");
 
   ObjectCreate("FibLevels", OBJ_FIBO, 0, Time[0],High[0],Time[0],Low[0]);
   ObjectCreate("BuyZone", OBJ_RECTANGLE, 0,0,0,0);
   ObjectCreate("SellZone", OBJ_RECTANGLE, 0,0,0,0);
 
   if (Show_StartLine)
        {if (ObjectFind(StartLine)==-1)
           {
            ObjectCreate(StartLine,OBJ_VLINE,0,Time[Fib_Period],Close[0]);
            ObjectSet(StartLine,OBJPROP_COLOR,StartLine_Color);
           }
        }
    if (Show_EndLine)
        {if (ObjectFind(EndLine)==-1)
           {
            ObjectCreate(EndLine,OBJ_VLINE,0,Time[0],Close[0]);
            ObjectSet(EndLine,OBJPROP_COLOR,EndLine_Color);
           }
        }
   return(0);
}
int deinit() {
   ObjectDelete("FibLevels");
   ObjectDelete("BuyZone");
   ObjectDelete("SellZone");
}
int start() {

 //Start Line -------------------------------------------
   int BarShift;
  if (Show_StartLine)
  {  
   datetime HLineTime=ObjectGet(StartLine,OBJPROP_TIME1);

   if (HLineTime>=Time[0]) {BarShift=0;}
     BarShift=iBarShift(NULL,0,HLineTime);
  }  
   else if (!Show_StartLine){BarShift=0;}
   if (ObjectFind(StartLine)==-1) {BarShift=0;}
 
 //End Line -------------------------------------------
   int BarShift2;
  if (Show_EndLine)
  {  
   datetime HLine2Time=ObjectGet(EndLine,OBJPROP_TIME1);

   if (HLine2Time>=Time[0]) {BarShift2=0;}
     BarShift2=iBarShift(NULL,0,HLine2Time);
  }  
   else if (!Show_EndLine){BarShift2=0;}
   if (ObjectFind(EndLine)==-1) {BarShift2=0;}  
//----------------------------------------------------------

   double SellZoneHigh,BuyZoneLow;
   if (Show_StartLine)
    {
    SellZoneHigh = iHigh(NULL,0,iHighest(NULL,0,MODE_HIGH,BarShift-BarShift2,BarShift2+1));
    BuyZoneLow = iLow(NULL,0,iLowest(NULL,0,MODE_LOW,BarShift-BarShift2,BarShift2+1));
    }
      if (!Show_StartLine)
    {
    SellZoneHigh = iHigh(NULL,0,iHighest(NULL,0,MODE_HIGH,Fib_Period,1));
    BuyZoneLow = iLow(NULL,0,iLowest(NULL,0,MODE_LOW,Fib_Period,1));
    }
   double PriceRange = SellZoneHigh - BuyZoneLow;
   double BuyZoneHigh = BuyZoneLow + (0.236*PriceRange);
   double SellZoneLow = SellZoneHigh - (0.236*PriceRange);
   datetime StartZoneTime =Time[Fib_Period];
   datetime EndZoneTime =Time[0]+Time[0];
 
   level_count=ArraySize(level_array);
 
   int    counted_bars=IndicatorCounted();
   int    limit,i;
 
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
 
   for(i=limit-1; i>=0; i--) {

      WWBuffer1[i] = getPeriodHigh(Fib_Period,i);
      WWBuffer2[i] = getPeriodLow(Fib_Period,i);
     
      if (Show_StartLine)
      {ObjectSet("FibLevels", OBJPROP_TIME1, Time[BarShift]);
       ObjectSet("FibLevels", OBJPROP_TIME2, Time[BarShift2]);}
      if (!Show_StartLine)
      {ObjectSet("FibLevels", OBJPROP_TIME1, StartZoneTime);}
      ObjectSet("FibLevels", OBJPROP_TIME2, Time[0]);
      if (Open[Fib_Period] < Open[0]) // Up
      {
        if (Show_StartLine)
         {
         ObjectSet("FibLevels", OBJPROP_PRICE1, SellZoneHigh);
         ObjectSet("FibLevels", OBJPROP_PRICE2, BuyZoneLow);
         }
        if (!Show_StartLine)
         {
         ObjectSet("FibLevels", OBJPROP_PRICE1, getPeriodHigh(Fib_Period,i));
         ObjectSet("FibLevels", OBJPROP_PRICE2, getPeriodLow(Fib_Period,i));
         }
      } else {
        if (Show_StartLine)
         {
         ObjectSet("FibLevels", OBJPROP_PRICE1, BuyZoneLow);
         ObjectSet("FibLevels", OBJPROP_PRICE2, SellZoneHigh);
         }
        if (!Show_StartLine)
         {
         ObjectSet("FibLevels", OBJPROP_PRICE1, getPeriodLow(Fib_Period,i));
         ObjectSet("FibLevels", OBJPROP_PRICE2, getPeriodHigh(Fib_Period,i));
         }
      }
      ObjectSet("FibLevels", OBJPROP_LEVELCOLOR, Fib_Color);
      ObjectSet("FibLevels", OBJPROP_STYLE, Fib_Style);
      ObjectSet("FibLevels", OBJPROP_FIBOLEVELS, level_count);
         for(int j=0; j<level_count; j++)
      {
      ObjectSet("FibLevels", OBJPROP_FIRSTLEVEL+j, level_array[j]);
      ObjectSetFiboDescription("FibLevels",j,leveldesc_array[j]);
      }
 
      if (Show_StartLine)
      {ObjectSet("BuyZone", OBJPROP_TIME2, Time[BarShift]);
       ObjectSet("BuyZone", OBJPROP_TIME1, Time[BarShift2]);}
      if (!Show_StartLine)
      {ObjectSet("BuyZone", OBJPROP_TIME2, StartZoneTime);}
      ObjectSet("BuyZone", OBJPROP_TIME1, EndZoneTime);
      ObjectSet("BuyZone", OBJPROP_PRICE1, BuyZoneLow);
      ObjectSet("BuyZone", OBJPROP_PRICE2, BuyZoneHigh);
      ObjectSet("BuyZone", OBJPROP_COLOR, BuyZone_Color);
     
      if (Show_StartLine)
      {ObjectSet("SellZone", OBJPROP_TIME2, Time[BarShift]);
      ObjectSet("SellZone", OBJPROP_TIME1, Time[BarShift2]);}
      if (!Show_StartLine)
      {ObjectSet("SellZone", OBJPROP_TIME2, StartZoneTime);}
      ObjectSet("SellZone", OBJPROP_TIME1, EndZoneTime);
      ObjectSet("SellZone", OBJPROP_PRICE1, SellZoneLow);
      ObjectSet("SellZone", OBJPROP_PRICE2, SellZoneHigh);
      ObjectSet("SellZone", OBJPROP_COLOR, SellZone_Color);
   }
   return(0);
}

double getPeriodHigh(int period, int pos)
{
   int i;
   double buffer = 0;
   for (i=pos;i<=pos+period;i++)
   {
       if (High[i] > buffer)
         {
            buffer = High[i];
         }
       else {
         if (Open[i] > Close[i]) // Down
         {
            if (Open[i] > buffer)
            {
               buffer = Open[i];
            }
         }
      }
   }
   return (buffer);
}
double getPeriodLow(int period, int pos) {
   int i;
   double buffer = 100000;
   for (i=pos;i<=pos+period;i++)
   {
         if (Low[i] < buffer)
         {
            buffer = Low[i];
         }
       else {
         if (Open[i] > Close[i]) // Down
         {
            if (Close[i] < buffer)
            {
               buffer = Close[i];
            }
         } else {
            if (Open[i] < buffer) {
               buffer = Open[i];
            }
         }
      }
   }
   return (buffer);
}
Read more >>

Murrey_Math_line_X

Silakan Copy script di bawah ini..


//+------------------------------------------------------------------+
//|                                           Murrey_Math_Line_X.mq4 |
//|                         Copyright © 2004, Vladislav Goshkov (VG).|
//|                                                      4vg@mail.ru |
//|                                 code change by Alex.Piech.FinGeR |
//+------------------------------------------------------------------+
#property copyright "Vladislav Goshkov (VG) && Alex.Piech.FinGeR"
#property link      "4vg@mail.ru && regnif@gmx.net"

#property indicator_chart_window

// ============================================================================================
// * Line 8/8 è 0/8 (Ultimate Support and Ultimate Resistance).
// * Those lines are the most strong concerning Support and esistance.
// ============================================================================================
//* Line 7/8  (Weak, Place to Stop and Reverse).
//* This line is weak. If suddenly the price was going too fast and too far and stops around this line
//* it means the price will reverse down very soon. If the price did not stop near this line this price
//* will continue the movement to the line 8/8.
// ============================================================================================
//* Line 1/8  (Weak, Place to Stop and Reverse).
//* This line is weak. If suddenly the price was going too fast and too far and stops around this line
//* it means the price will reverse up very soon. If the price did not stop near this line this price
//* will continue the movement down to the line 0/8.
// ============================================================================================
//* Line 2/8 and 6/8 (Pivot, Reverse)
//* Those two lines yield the line 4/8 only to the strength to reverse the price movement.
// ============================================================================================
//* Line 5/8 (Top of Trading Range)
//* The price is spending the about 40% of the time on the movement between the lines 5/8 and 3/8.
//* If the price is moving near line 5/8 and stopping near the line during the 10 - 12 days so it means
//* that it is necessary to sell in this "bonus zone" (some people are doing like this) but if the price is keeping the tendency to stay above
//* 5/8 line, so it means that the price will be above. But if the price is droping below 5/8 line it means that the price will continue
//* falling to the next level of resistance.
// ============================================================================================
//* Line 3/8 (Bottom of Trading Range).
//* If the price is below this line and in uptrend it means that it will be very difficult for the price to break this level.
//* If the price broke this line during the uptrend and staying above during the 10 12 days it means that the price will be above this line
//* during the 40% of its time moving between this line and 5/8 line.
// ============================================================================================
//* Line 4/8 (Major Support/Resistance Line).
//* It is the major line concerning support and resistance. This leve is the better for the new sell or buy.
//* It is the strong level of support of the price is above 4/8. It is the fine resistance line if the price is below this 4/8 line.
//* ñîïðîòèâëåíèÿ.
// ============================================================================================
extern int P = 64;
extern int MMPeriod = 1440;
extern int StepBack = 0;

extern color  mml_clr_m_2_8 = White;       // [-2]/8
extern color  mml_clr_m_1_8 = White;       // [-1]/8
extern color  mml_clr_0_8   = Aqua;        //  [0]/8
extern color  mml_clr_1_8   = Yellow;      //  [1]/8
extern color  mml_clr_2_8   = Red;         //  [2]/8
extern color  mml_clr_3_8   = Green;       //  [3]/8
extern color  mml_clr_4_8   = Blue;        //  [4]/8
extern color  mml_clr_5_8   = Green;       //  [5]/8
extern color  mml_clr_6_8   = Red;         //  [6]/8
extern color  mml_clr_7_8   = Yellow;      //  [7]/8
extern color  mml_clr_8_8   = Aqua;        //  [8]/8
extern color  mml_clr_p_1_8 = White;       // [+1]/8
extern color  mml_clr_p_2_8 = White;       // [+2]/8

extern int    mml_wdth_m_2_8 = 2;        // [-2]/8
extern int    mml_wdth_m_1_8 = 1;       // [-1]/8
extern int    mml_wdth_0_8   = 1;        //  [0]/8
extern int    mml_wdth_1_8   = 1;      //  [1]/8
extern int    mml_wdth_2_8   = 1;         //  [2]/8
extern int    mml_wdth_3_8   = 1;       //  [3]/8
extern int    mml_wdth_4_8   = 1;        //  [4]/8
extern int    mml_wdth_5_8   = 1;       //  [5]/8
extern int    mml_wdth_6_8   = 1;         //  [6]/8
extern int    mml_wdth_7_8   = 1;      //  [7]/8
extern int    mml_wdth_8_8   = 1;        //  [8]/8
extern int    mml_wdth_p_1_8 = 1;       // [+1]/8
extern int    mml_wdth_p_2_8 = 2;       // [+2]/8

extern color  MarkColor   = Blue;
extern int    MarkNumber  = 217;


double  dmml = 0,
        dvtl = 0,
        sum  = 0,
        v1 = 0,
        v2 = 0,
        mn = 0,
        mx = 0,
        x1 = 0,
        x2 = 0,
        x3 = 0,
        x4 = 0,
        x5 = 0,
        x6 = 0,
        y1 = 0,
        y2 = 0,
        y3 = 0,
        y4 = 0,
        y5 = 0,
        y6 = 0,
        octave = 0,
        fractal = 0,
        range   = 0,
        finalH  = 0,
        finalL  = 0,
        mml[13];

string  ln_txt[13],       
        buff_str = "";
       
int    
        bn_v1   = 0,
        bn_v2   = 0,
        OctLinesCnt = 13,
        mml_thk = 8,
        mml_clr[13],
        mml_wdth[13],
        mml_shft = 35,
        nTime = 0,
        CurPeriod = 0,
        nDigits = 0,
        i = 0;
int NewPeriod=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init() {
//---- indicators
   if(MMPeriod>0)
      NewPeriod   = P*MathCeil(MMPeriod/Period());
   else NewPeriod = P;
  
   ln_txt[0]  = "[-2/8]P";// "extremely overshoot [-2/8]";// [-2/8]
   ln_txt[1]  = "[-1/8]P";// "overshoot [-1/8]";// [-1/8]
   ln_txt[2]  = "[0/8]P";// "Ultimate Support - extremely oversold [0/8]";// [0/8]
   ln_txt[3]  = "[1/8]P";// "Weak, Place to Stop and Reverse - [1/8]";// [1/8]
   ln_txt[4]  = "[2/8]P";// "Pivot, Reverse - major [2/8]";// [2/8]
   ln_txt[5]  = "[3/8]P";// "Bottom of Trading Range - [3/8], if 10-12 bars then 40% Time. BUY Premium Zone";//[3/8]
   ln_txt[6]  = "[4/8]P";// "Major Support/Resistance Pivotal Point [4/8]- Best New BUY or SELL level";// [4/8]
   ln_txt[7]  = "[5/8]P";// "Top of Trading Range - [5/8], if 10-12 bars then 40% Time. SELL Premium Zone";//[5/8]
   ln_txt[8]  = "[6/8]P";// "Pivot, Reverse - major [6/8]";// [6/8]
   ln_txt[9]  = "[7/8]P";// "Weak, Place to Stop and Reverse - [7/8]";// [7/8]
   ln_txt[10] = "[8/8]P";// "Ultimate Resistance - extremely overbought [8/8]";// [8/8]
   ln_txt[11] = "[+1/8]P";// "overshoot [+1/8]";// [+1/8]
   ln_txt[12] = "[+2/8]P";// "extremely overshoot [+2/8]";// [+2/8]

   //mml_shft = 3;
   mml_thk  = 3;

   // Íà÷àëüíàÿ óñòàíîâêà öâåòîâ óðîâíåé îêòàâ è òîëùèíû ëèíèé
   mml_clr[0]  = mml_clr_m_2_8;   mml_wdth[0] = mml_wdth_m_2_8; // [-2]/8
   mml_clr[1]  = mml_clr_m_1_8;   mml_wdth[1] = mml_wdth_m_1_8; // [-1]/8
   mml_clr[2]  = mml_clr_0_8;     mml_wdth[2] = mml_wdth_0_8;   //  [0]/8
   mml_clr[3]  = mml_clr_1_8;     mml_wdth[3] = mml_wdth_1_8;   //  [1]/8
   mml_clr[4]  = mml_clr_2_8;     mml_wdth[4] = mml_wdth_2_8;   //  [2]/8
   mml_clr[5]  = mml_clr_3_8;     mml_wdth[5] = mml_wdth_3_8;   //  [3]/8
   mml_clr[6]  = mml_clr_4_8;     mml_wdth[6] = mml_wdth_4_8;   //  [4]/8
   mml_clr[7]  = mml_clr_5_8;     mml_wdth[7] = mml_wdth_5_8;   //  [5]/8
   mml_clr[8]  = mml_clr_6_8;     mml_wdth[8] = mml_wdth_6_8;   //  [6]/8
   mml_clr[9]  = mml_clr_7_8;     mml_wdth[9] = mml_wdth_7_8;   //  [7]/8
   mml_clr[10] = mml_clr_8_8;     mml_wdth[10]= mml_wdth_8_8;   //  [8]/8
   mml_clr[11] = mml_clr_p_1_8;   mml_wdth[11]= mml_wdth_p_1_8; // [+1]/8
   mml_clr[12] = mml_clr_p_2_8;   mml_wdth[12]= mml_wdth_p_2_8; // [+2]/8
  
  
//----
   return(0);
  }

//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit() {
//---- TODO: add your code here
Comment(" ");  
for(i=0;i<OctLinesCnt;i++) {
    buff_str = "mml"+i;
    ObjectDelete(buff_str);
    buff_str = "mml_txt"+i;
    ObjectDelete(buff_str);
    buff_str = "MML_LatestCulcBar";
    ObjectDelete(buff_str);
    }
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {

//---- TODO: add your code here

if( (nTime != Time[0]) || (CurPeriod != Period()) ) {
  
  //price
   bn_v1 = Lowest(NULL,0,MODE_LOW,NewPeriod+StepBack,StepBack);
   bn_v2 = Highest(NULL,0,MODE_HIGH,NewPeriod+StepBack,StepBack);

   v1 = Low[bn_v1];
   v2 = High[bn_v2];

//determine fractal.....
   if( v2<=250000 && v2>25000 )
   fractal=100000;
   else
     if( v2<=25000 && v2>2500 )
     fractal=10000;
     else
       if( v2<=2500 && v2>250 )
       fractal=1000;
       else
         if( v2<=250 && v2>25 )
         fractal=100;
         else
           if( v2<=25 && v2>12.5 )
           fractal=12.5;
           else
             if( v2<=12.5 && v2>6.25)
             fractal=12.5;
             else
               if( v2<=6.25 && v2>3.125 )
               fractal=6.25;
               else
                 if( v2<=3.125 && v2>1.5625 )
                 fractal=3.125;
                 else
                   if( v2<=1.5625 && v2>0.390625 )
                   fractal=1.5625;
                   else
                     if( v2<=0.390625 && v2>0)
                     fractal=0.1953125;
     
   range=(v2-v1);
   sum=MathFloor(MathLog(fractal/range)/MathLog(2));
   octave=fractal*(MathPow(0.5,sum));
   mn=MathFloor(v1/octave)*octave;
   if( (mn+octave)>v2 )
   mx=mn+octave;
   else
     mx=mn+(2*octave);


// calculating xx
//x2
    if( (v1>=(3*(mx-mn)/16+mn)) && (v2<=(9*(mx-mn)/16+mn)) )
    x2=mn+(mx-mn)/2;
    else x2=0;
//x1
    if( (v1>=(mn-(mx-mn)/8))&& (v2<=(5*(mx-mn)/8+mn)) && (x2==0) )
    x1=mn+(mx-mn)/2;
    else x1=0;

//x4
    if( (v1>=(mn+7*(mx-mn)/16))&& (v2<=(13*(mx-mn)/16+mn)) )
    x4=mn+3*(mx-mn)/4;
    else x4=0;

//x5
    if( (v1>=(mn+3*(mx-mn)/8))&& (v2<=(9*(mx-mn)/8+mn))&& (x4==0) )
    x5=mx;
    else  x5=0;

//x3
    if( (v1>=(mn+(mx-mn)/8))&& (v2<=(7*(mx-mn)/8+mn))&& (x1==0) && (x2==0) && (x4==0) && (x5==0) )
    x3=mn+3*(mx-mn)/4;
    else x3=0;

//x6
    if( (x1+x2+x3+x4+x5) ==0 )
    x6=mx;
    else x6=0;

     finalH = x1+x2+x3+x4+x5+x6;
// calculating yy
//y1
    if( x1>0 )
    y1=mn;
    else y1=0;

//y2
    if( x2>0 )
    y2=mn+(mx-mn)/4;
    else y2=0;

//y3
    if( x3>0 )
    y3=mn+(mx-mn)/4;
    else y3=0;

//y4
    if( x4>0 )
    y4=mn+(mx-mn)/2;
    else y4=0;

//y5
    if( x5>0 )
    y5=mn+(mx-mn)/2;
    else y5=0;

//y6
    if( (finalH>0) && ((y1+y2+y3+y4+y5)==0) )
    y6=mn;
    else y6=0;

    finalL = y1+y2+y3+y4+y5+y6;

    for( i=0; i<OctLinesCnt; i++) {
         mml[i] = 0;
         }
        
   dmml = (finalH-finalL)/8;

   mml[0] =(finalL-dmml*2); //-2/8
   for( i=1; i<OctLinesCnt; i++) {
        mml[i] = mml[i-1] + dmml;
        }
   for( i=0; i<OctLinesCnt; i++ ){
        buff_str = "mml"+i;
        if(ObjectFind(buff_str) == -1) {
           ObjectCreate(buff_str, OBJ_HLINE , 0,Time[0], mml[i]);
           ObjectSet(buff_str, OBJPROP_STYLE, STYLE_SOLID);
           ObjectSet(buff_str, OBJPROP_COLOR, mml_clr[i]);
           ObjectSet(buff_str, OBJPROP_WIDTH, mml_wdth[i]);
       ObjectMove(buff_str, 0, Time[0],  mml[i]);
           }
        else {
      ObjectMove(buff_str, 0, Time[0],  mml[i]);
           }
            
        buff_str = "mml_txt"+i;
        if(ObjectFind(buff_str) == -1) {
           ObjectCreate(buff_str, OBJ_TEXT, 0, Time[mml_shft], mml_shft);
           ObjectSetText(buff_str, ln_txt[i], 8, "Arial", mml_clr[i]);
           ObjectMove(buff_str, 0, Time[mml_shft],  mml[i]);
           }
        else {
           ObjectMove(buff_str, 0, Time[mml_shft],  mml[i]);
           }
        } // for( i=1; i<=OctLinesCnt; i++ ){

   nTime    = Time[0];
   CurPeriod= Period();
  
   string buff_str = "MML_LatestCulcBar";
   if(ObjectFind(buff_str) == -1) {
      ObjectCreate(buff_str, OBJ_ARROW,0, Time[StepBack], Low[StepBack]-2*Point );
      ObjectSet(buff_str, OBJPROP_ARROWCODE, MarkNumber);
      ObjectSet(buff_str, OBJPROP_COLOR, MarkColor);
      }
   else {
      ObjectMove(buff_str, 0, Time[StepBack], Low[StepBack]-2*Point );
      }

   }

//---- End Of Program
  return(0);
  }
//+------------------------------------------------------------------+
Read more >>