change this line to:
Histogram =iCustom (NULL,0,"Histogram",0,0,10);
and this one to:
Sars=iSAR(NULL,0.01,0.1, 0, 0);
and your order send is missing some parameters...
int OrderSend( | string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit, string comment=NULL, int magic=0, datetime expiration=0, color arrow_color=CLR_NONE) |
el-smart:
please check and correct it for me
- No slaves here, learn to code or pay someone. At least figure out why you have compile errors and fix them before posting.
el-smart:
please i need help here.
I am a new MQ4 student.
i made this EA SAMPLE,
Here I use 2 indicator : PARABOLIC SARS (0.01, 0.1) and HISTOGRAM (period 10)
please check and correct it for me
Histogram =(iCustom (NULL,0,"Histogram",0,0,10);
u have more compiling issues
Sars=iSAR(NULL,0.01,0.1); //check again the parameters
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask); read more about OrderSend()
ticket=OrderSend(Symbol(),OP_BUY,Lots);
& please for the next time
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
please i need help here.
I am a new MQ4 student.
i made this EA SAMPLE,
Here I use 2 indicator : PARABOLIC SARS (0.01, 0.1) and HISTOGRAM (period 10)
please check and correct it for me
==================================================================================================================================================
//+------------------------------------------------------------------+
//| Sample.mq4 |
//| Copyright © 2005, MetaQuotes Software Corp. |
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
extern double Lots = 0.1;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
double Sars;
double Histogram;
int cnt, ticket;
Sars=iSAR(NULL,0.01,0.1);
Histogram =(iCustom (NULL,0,"Histogram",0,0,10);
// check for long position (BUY) possibility
if(Histogram >=1 && Sars < Ask)
{
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask);
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);
// check for short position (SELL) possibility
if(Histogram >=1 && Sars > Bid)
{
ticket=OrderSend(Symbol(),OP_BUY,Lots);
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);
}
// it is important to enter the market correctly,
// but it is more important to exit it correctly...
if(OrderType()==OP_BUY) // long position is opened
{
// should it be closed?
if(Histogram <-0.2)
{
OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); // close position
return(0); // exit
}
}
if(OrderType()==OP_SELL) // short position is opened
{
// should it be closed?
if(Histogram>0.2)
{
OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); // close position
return(0); // exit
}
}
}
}
return(0);
// the end.