How can I work with open close prices?

 

Hi,

I have simple problem with my code.I need work with prices close[1]-low[1] ; open[0]-close[0] etc...

How can I do it?

An example:

I will go long when open[1] - low[1] > as 20 pip.

double OPEN1 = iOpen(NULL,60,1);
double LOW1 = iLow(NULL,60,1);

Isignal =(OPEN1 - LOW1);

if (Isignal > 20 * Point)
{
ticket=OrderSend(Symbol(), OP_BUY, lot, Ask, 0, Bid - sl * Point, Bid + tp * Point, "StrategyLong", mn, 0, Blue);
if(ticket<0)
{
Print("OrderSend failed with error #",GetLastError());
}

}
return(0);
}

Thx for you help!

BR,

poleva

 

this code seems correct. what's wrong with it?


by the way, use the Code tag to post any code. thanks!

 
GarF1eld wrote >>

this code seems correct. what's wrong with it?

by the way, use the Code tag to post any code. thanks!

I don't have idea too.But I get allway this error!

I looked on the help but there is:

not correct stop price.

And stop is from my side OK.

2008.11.17 15:02:47 2008.10.21 20:00 Fuzzy60EUR EURUSD,H1: OrderSend failed with error #130

 
poleva wrote >>

I don't have idea too.But I get allway this error!

I looked on the help but there is:

not correct stop price.

And stop is from my side OK.

2008.11.17 15:02:47 2008.10.21 20:00 Fuzzy60EUR EURUSD,H1: OrderSend failed with error #130

Hello!

What is your sl ? If it's set at 0 (zero), I believe it would generate sucha an error message, because Bid - sl * Point would be equal to Bid...

 
rubencouto wrote >>

Hello!

What is your sl ? If it's set at 0 (zero), I believe it would generate sucha an error message, because Bid - sl * Point would be equal to Bid...

Hi,

thx for your help!

Here is my complete code.Could you check it please?

//+------------------------------------------------------------------+
//| FuzzyLogic60minEURUSD.mq4 |
//| Valdo Poleva |
//| |
//+------------------------------------------------------------------+
#property copyright "Valdo Poleva"
//---- input parameters

extern double tp = 20;
extern double sl = 100;
extern double lot = 5;
extern int mn = 888;
static int prevtime = 0;

//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----

if (Time[0] == prevtime)
{
return(0);
}
prevtime = Time[0];

int total = OrdersTotal();
for (int i = 0; i < total; i++)
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() == Symbol() && OrderMagicNumber() == mn)
{
return(0);
}

int lFlagBuyOpen;
double OPEN1 = iOpen(NULL,60,1);
double LOW1 = iLow(NULL,60,1);
lFlagBuyOpen = (OPEN1 - LOW1);

int ticket;

if (Hour()>=8 && Hour()<=12 && lFlagBuyOpen > 20 * Point)
{
ticket = OrderSend(Symbol(),OP_BUY,lot,Ask,3,Ask - sl * Point,Ask + tp * Point,"StrategyLong",mn,0,Blue);
if(ticket<0)
{
Print("OrderSend failed with error #",GetLastError());
}

}
return(0);
}
//+------------------------------------------------------------------+



//+------------------------------------------------------------------+

Thanks.

Poleva

Reason: