//+------------------------------------------------------------------+
//| BEOVB_BUOVB_bar.mq4 |
//| Copyright 2015, Iglakov Dmitry. |
//|
[email protected] |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, Iglakov Dmitry."
#property link "
[email protected]"
#property version "1.00"
#property strict
extern int st = 30;
extern int interval = 25; //Interval
extern double lot = 0.1; //Lot Size
extern int TP = 400; //Take Profit
extern int magic = 962231; //Magic number
extern int slippage = 2; //Slippage
extern int ExpDate = 48; //Expiration Hour Order
extern int bar1size = 900; //Bar 1 Size
double t;
double buyPrice,//define BuyStop setting price
buyTP, //Take Profit BuyStop
buySL, //Stop Loss BuyStop
sellPrice, //define SellStop setting price
sellTP, //Take Profit SellStop
sellSL; //Stop Loss SellStop
double open1,//first candle Open price
open2, //second candle Open price
close1, //first candle Close price
close2, //second candle Close price
low1, //first candle Low price
low2, //second candle Low price
high1, //first candle High price
high2; //second candle High price
datetime _ExpDate =0; // local variable for defining pending orders expiration time
double _bar1size;// local variable required to avoid a flat market
datetime timeBUOVB_BEOVB;// time of a bar when pattern orders were opened, to avoid re-opening
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
(
//--- (
double ticksize = MarketInfo(Symbol(),MODE_TICKSIZE) ;
if (ticksize == 0.00001 || ticksize == 0.001)
double t = ticksize*10;
else t =ticksize
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
(
double _bid = NormalizeDouble(MarketInfo (Symbol(), MODE_BID), Digits); // define Low price
double _ask = NormalizeDouble(MarketInfo(Symbol(), MODE_ASK), Digits); //define High price
double _point = MarketInfo(Symbol(), MODE_POINT);
//--- define prices of necessary bars
open1 = NormalizeDouble(iOpen(Symbol(), Period(), 1), Digits);
open2 = NormalizeDouble(iOpen(Symbol(), Period(), 2), Digits);
close1 = NormalizeDouble(iClose(Symbol(), Period(), 1), Digits);
close2 = NormalizeDouble(iClose(Symbol(), Period(), 2), Digits);
low1 = NormalizeDouble(iLow(Symbol(), Period(), 1), Digits);
low2 = NormalizeDouble(iLow(Symbol(), Period(), 2), Digits);
high1 = NormalizeDouble(iHigh(Symbol(), Period(), 1), Digits);
high2 = NormalizeDouble(iHigh(Symbol(), Period(), 2), Digits);
//---
_bar1size=NormalizeDouble(((high1-low1)/_point),0);
//--- Finding bearish pattern BEOVB
if(timeBUOVB_BEOVB!=iTime(Symbol(),Period(),1) && //orders are not yet opened for this pattern
_bar1size > bar1size && //first bar is big enough, so the market is not flat
low1 < low2 &&//First bar's Low is below second bar's Low
high1 > high2 &&//First bar's High is above second bar's High
close1 < open2 && //First bar's ?lose price is lower than second bar's Open price
open1 > close1 && //First bar is a bearish bar
open2 < close2) //Second bar is a bullish bar
{
//--- we have described all conditions indicating that the first bar completely engulfs the second bar and is a bearish bar
timeBUOVB_BEOVB=iTime(Symbol(),Period(),1); // indicate that orders are already placed on this pattern
}
//--- Finding bullish pattern BUOVB
if(timeBUOVB_BEOVB!=iTime(Symbol(),Period(),1) && //orders are not yet opened for this pattern
_bar1size > bar1size && //first bar is big enough not to consider a flat market
low1 < low2 &&//First bar's Low is below second bar's Low
high1 > high2 &&//First bar's High is above second bar's High
close1 > open2 && //First bar's Close price is higher than second bar's Open price
open1 < close1 && //First bar is a bullish bar
open2 > close2) //Second bar is a bearish bar
{
//--- we have described all conditions indicating that the first bar completely engulfs the second bar and is a bullish bar
timeBUOVB_BEOVB=iTime(Symbol(),Period(),1); // indicate that orders are already placed on this pattern
int t=OrderSend(Symbol(),OP_BUY,lot,Ask,3,Ask-st,Ask-TP,NULL,magic=0);
t=OrderSend (Symbol,OP_SELL,lot,Bid,3,Bid+st,Bid-TP,NULL,magic=0);
)
الملف المرفق 477701الملف المرفق 477702
شكرا علي مساعدتكم ولكن ايضا يوجد خطا انظروو