You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
How far goes i? What is Bars-1 number?
It doesn't work! I really don't know what to do...
[...]
It doesn't work! I really don't know what to do...
It what way doesn't it work? Are the values wrong? Are they not getting calculated at all?
It what way doesn't it work? Are the values wrong? Are they not getting calculated at all?
I can't figure it out. I have order to open buy when the price is bigger then HighValue and vice versa for sell.
How can write these values at monitor? With Print("High value: ",HighValue);
I think that is the only way to find what these values are, but they are not high/low between 15.00 and 17.00.
Yes. I think that the best is to put code here an then maybe someone find a solution.
if(Hour() == 17 && gethighlows == true)
{
gethighlows = false;
TopRange=High[iHighest(NULL,15,MODE_HIGH,8,1)]; // 8 M15 bars between 15.00-17.00
LowRange=Low[iLowest(NULL,15,MODE_LOW,8,1)]; // 8 M15 bars between 15.00-17.00
}
//-----
if (Hour() ==0 && (Minute()==0 && (Seconds()==1)))
{
TopRange=0;
LowRange=0;
bought=false;
sold=false;
sessionfound=false;
}
//-----
bool TradeDayOK=(DayOfWeek()>=1) && (DayOfWeek()<=5);
if ((DayOfWeek()==1) && (Trade_on_Monday==true)) TradeDayOK=true;
//-----
total=OrdersTotal();
if(total<1)
{
if(AccountFreeMargin()<(1000*Lots))
{
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
if(newbar==Time[0])return(0);
else newbar=Time[0];
if(TradeDayOK)
{
if(sessionfound && ( (Hour()>=17) && (Minute()>15) && Hour()<=23)
{
if ((bought==false) && (Low[1] > (TopRange+Point*3)))
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-(StopLoss*Point),Ask+(TakeProfit*Point),0,0,Blue);
bought=true;
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
}
else Print("Error opening BUY order : ",GetLastError());
return(0);
}
if ((sold==false) && (High[1] < (LowRange-Point*3) ))
{
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+(StopLoss*Point),Bid-(TakeProfit*Point),0,0,Red);
sold=true;
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());
}
else Print("Error opening SELL order : ",GetLastError());
return(0);
}
return(0);
}
return(0);
}
}
Yes. I think that the best is to put code here an then maybe someone find a solution.
if(Hour() == 17 && gethighlows == true)
{
gethighlows = false;
TopRange=High[iHighest(NULL,15,MODE_HIGH,8,1)]; // 8 M15 bars between 15.00-17.00
LowRange=Low[iLowest(NULL,15,MODE_LOW,8,1)]; // 8 M15 bars between 15.00-17.00
}
//-----
if (Hour() ==0 && (Minute()==0 && (Seconds()==1)))
{
TopRange=0;
LowRange=0;
bought=false;
sold=false;
sessionfound=false;
}
//-----
bool TradeDayOK=(DayOfWeek()>=1) && (DayOfWeek()<=5);
if ((DayOfWeek()==1) && (Trade_on_Monday==true)) TradeDayOK=true;
//-----
total=OrdersTotal();
if(total<1)
{
if(AccountFreeMargin()<(1000*Lots))
{
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
if(newbar==Time[0])return(0);
else newbar=Time[0];
if(TradeDayOK)
{
if(sessionfound && ( (Hour()>=17) && (Minute()>15) && Hour()<=23)
{
if ((bought==false) && Ask >= TopRange)
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-(StopLoss*Point),Ask+(TakeProfit*Point),0,0,Blue);
bought=true;
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
}
else Print("Error opening BUY order : ",GetLastError());
return(0);
}
if ((sold==false) && Bid <= LowRange)
{
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+(StopLoss*Point),Bid-(TakeProfit*Point),0,0,Red);
sold=true;
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());
}
else Print("Error opening SELL order : ",GetLastError());
return(0);
}
return(0);
}
return(0);
}
}