//+------------------------------------------------------------------+ //| Exp_ADX_Cross_Hull_Style.mq5 | //| Copyright © 2011, Nikolay Kositsin | //| Khabarovsk, farria@mail.redcom.ru | //+------------------------------------------------------------------+ #property copyright "Copyright © 2011, Nikolay Kositsin" #property link "farria@mail.redcom.ru" #property version "1.00" //+----------------------------------------------+ //| Expert Advisor indicator input parameters | //+----------------------------------------------+ input double MM=-0.1; //Share of a deposit in a deal, negative values - lot size input int StopLoss_=1000; //Stop Loss in points input int TakeProfit_=2000; // Take Profit in points input int Deviation_=10; //max. price deviation in points input bool BuyPosOpen=true; // Permission to buy input bool SellPosOpen=true; // Permission to sell input bool BuyPosClose=true; // Permission to exit long positions input bool SellPosClose=true; // Permission to exit short positions //+----------------------------------------------+ //| Indicator input parameters | //+----------------------------------------------+ input ENUM_TIMEFRAMES InpInd_Timeframe=PERIOD_H4; //indicators time frame //---- input uint ADXPeriod=14;//indicator period //---- input uint SignalBar=1; //bar index for getting an entry signal //+----------------------------------------------+ int TimeShiftSec; //---- Declaration of integer variables for the indicator handles int InpInd_Handle; //---- declaration of the integer variables for the start of data calculation int min_rates_total; //+------------------------------------------------------------------+ // Trading algorithms | //+------------------------------------------------------------------+ #include //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //---- getting the ADX_Cross_Hull_Style indicator handle InpInd_Handle=iCustom(Symbol(),InpInd_Timeframe,"ADX_Cross_Hull_Style",ADXPeriod,0); if(InpInd_Handle==INVALID_HANDLE) Print(" Failed to get handle of ADX_Cross_Hull_Style indicator"); //---- initialization of a variable for storing a chart period in seconds TimeShiftSec=PeriodSeconds(InpInd_Timeframe); //---- initialization of variables of the start of data calculation int AtrPeriod=10; min_rates_total=int(MathMax(ADXPeriod+1,AtrPeriod)); min_rates_total+=int(3+SignalBar); //---- return(0); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //---- GlobalVariableDel_(Symbol()); //---- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //---- checking the number of bars to be enough for calculation if(BarsCalculated(InpInd_Handle)