Hi guys, iam trying to write a simple EA that would place orders when HGI signals treadbuy/sell etc. However using the icustom commend i've came up with the blow scripts.
Code: Select all
extern double LotSize=0.01;
extern double Stoploss=30.0;
extern double TakeProfit=10.0;
extern int Slippage=5;
extern int MagicNumber=123;
extern bool UpdateSecondsDelay=true;
extern bool TrendSize=true;
extern bool RangeSize=true;
extern bool RadSize=true;
extern bool WavySize=true;
int BuyOrder;
int SellOrder;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
double Y1, Y2, Y3, Y4, Y5, Y6, Y7, Y8;
double SL, TP;
SL=Bid-(Stoploss)*Point;
TP=Bid+(TakeProfit)*Point;
{
Y1 = iCustom(NULL,0,"HGI_v17.00", UpdateSecondsDelay, TrendSize, RangeSize, RadSize, WavySize,0,0);
Y2 = iCustom(NULL,0,"HGI_v17.00", UpdateSecondsDelay, TrendSize, RangeSize, RadSize, WavySize,1,0);
Y3 = iCustom(NULL,0,"HGI_v17.00", UpdateSecondsDelay, TrendSize, RangeSize, RadSize, WavySize,2,0);
Y4 = iCustom(NULL,0,"HGI_v17.00", UpdateSecondsDelay, TrendSize, RangeSize, RadSize, WavySize,3,0);
Y5 = iCustom(NULL,0,"HGI_v17.00", UpdateSecondsDelay, TrendSize, RangeSize, RadSize, WavySize,4,0);
Y6 = iCustom(NULL,0,"HGI_v17.00", UpdateSecondsDelay, TrendSize, RangeSize, RadSize, WavySize,5,0);
Y7 = iCustom(NULL,0,"HGI_v17.00", UpdateSecondsDelay, TrendSize, RangeSize, RadSize, WavySize,6,0);
Y8 = iCustom(NULL,0,"HGI_v17.00", UpdateSecondsDelay, TrendSize, RangeSize, RadSize, WavySize,7,0);
}
if (Y1 > 0.0001)
{BuyOrder=OrderSend(Symbol(), OP_BUY, LotSize,Ask,5,SL,TP,"Buy Order",MagicNumber, 0,Blue);}
if (Y2 > 0.0001)
{SellOrder=OrderSend(Symbol(), OP_SELL, LotSize,Bid,5,SL,TP,"Sell Order",MagicNumber, 0,Red);}
if (Y3 > 0.0001)
{BuyOrder=OrderSend(Symbol(), OP_BUY, LotSize,Ask,5,SL,TP,"Buy Order",MagicNumber, 0,Blue);}
if (Y4 > 0.0001)
{SellOrder=OrderSend(Symbol(), OP_SELL, LotSize,Bid,5,SL,TP,"Sell Order",MagicNumber, 0,Red);}
if (Y5 > 0.0001)
{BuyOrder=OrderSend(Symbol(), OP_BUY, LotSize,Ask,5,SL,TP,"Buy Order",MagicNumber, 0,Blue);}
if (Y6 > 0.0001)
{SellOrder=OrderSend(Symbol(), OP_SELL, LotSize,Bid,5,SL,TP,"Sell Order",MagicNumber, 0,Red);}
if (Y7 > 0.0001)
{BuyOrder=OrderSend(Symbol(), OP_BUY, LotSize,Ask,5,SL,TP,"Buy Order",MagicNumber, 0,Blue);}
if (Y8 > 0.0001)
{SellOrder=OrderSend(Symbol(), OP_SELL, LotSize,Bid,5,SL,TP,"Sell Order",MagicNumber, 0,Red);}
return(0);
}
The problem iam getting right now is that i don't think this script is following the HGI signals at all, since iam pretty much guessing the buffer 0-7 as ctrl -d shows the data in order. Also i've noticed a isicustom in HGI inputs, what does this have to do in relation to my EA?
I know i still have a long way to go with this, and any help would be much appreciated. Thank you.