I have written an EA that works on a probability value that is recieved from an indicator via the iCustom. But this EA does not seem to be working , can anyone tell me what is wrong with this code? If anyone is interested I will post up the final project as soon as its done , it is a realy great EA... if it would work 
It never seems to enter trades even though the probability % is above the desired level. And the indicator also never updates itself.
Thanks a lot !!
property copyright "Copyright
2010, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
extern int Open_Percentage = 80 ;
extern int Close_Percentage = 40 ;
extern int Take_Profit = 13 ;
extern int Stop_Loss = 15 ;
int PMI ;
string TI ;
int buy ;
int sell ;
extern int Max_Order_Count = 1;
extern double Slippage = 3;
extern int Magic_Number = 10810 ;
extern double Lots = 0.05 ;
int init()
{
//----
iCustom(NULL, 0, "MEGATREND PROBABILITY METER II",13,7,0) ;
//----
return(0);
}
int start()
{
//-
string Probability_Value = ObjectDescription("prop_value");
PMI = StrToDouble(StringSubstr(Probability_Value,0,StringLen(Probability_Value)-1));
TI = ObjectDescription("trend_comment_");
buy = StringFind(TI,"LONG",0);
sell = StringFind(TI,"SHORT",0);
if (Open_Percentage > PMI)
{
return(0);
}
if(OrdersTotal() < Max_Order_Count)
{
if(PMI > Open_Percentage && buy != -1)
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,0,Ask - Stop_Loss * Point,Ask + Take_Profit * Point,Magic_Number,0,Green);
}
}
if(OrdersTotal() < Max_Order_Count)
{
if(PMI > Open_Percentage && sell != -1)
{
OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,Bid + Stop_Loss * Point,Ask - Take_Profit * Point,0,Magic_Number,0,Red);
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
It never seems to enter trades even though the probability % is above the desired level. And the indicator also never updates itself.
Thanks a lot !!
property copyright "Copyright
#property link "http://www.metaquotes.net"
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
extern int Open_Percentage = 80 ;
extern int Close_Percentage = 40 ;
extern int Take_Profit = 13 ;
extern int Stop_Loss = 15 ;
int PMI ;
string TI ;
int buy ;
int sell ;
extern int Max_Order_Count = 1;
extern double Slippage = 3;
extern int Magic_Number = 10810 ;
extern double Lots = 0.05 ;
int init()
{
//----
iCustom(NULL, 0, "MEGATREND PROBABILITY METER II",13,7,0) ;
//----
return(0);
}
int start()
{
//-
string Probability_Value = ObjectDescription("prop_value");
PMI = StrToDouble(StringSubstr(Probability_Value,0,StringLen(Probability_Value)-1));
TI = ObjectDescription("trend_comment_");
buy = StringFind(TI,"LONG",0);
sell = StringFind(TI,"SHORT",0);
if (Open_Percentage > PMI)
{
return(0);
}
if(OrdersTotal() < Max_Order_Count)
{
if(PMI > Open_Percentage && buy != -1)
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,0,Ask - Stop_Loss * Point,Ask + Take_Profit * Point,Magic_Number,0,Green);
}
}
if(OrdersTotal() < Max_Order_Count)
{
if(PMI > Open_Percentage && sell != -1)
{
OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,Bid + Stop_Loss * Point,Ask - Take_Profit * Point,0,Magic_Number,0,Red);
}
}
//----
return(0);
}
//+------------------------------------------------------------------+