Hey! I am running multiple EAs on multiple time frames , now I have coded these EAs myself... I have coded these EAs to only enter one trade at a time... But as soon as this trade has closed , I want It to put in another trade if paramenters are still correct , so how can you tell the EA that the trade that has just been entered has closed ? You cant use the TotalOrders() function because that interferes with my other EAs and their trades.
So can you please help me to somehow code my EA to know when the trade it entered has closed and has to reinitialise its parameters and set the total trades back to 0 ....
I am also getting the error : Memory handler : cannot allocate 630892 bytes of memory ...
any idea how I can clear the memory my EA uses now and then and re-load it... I do have enough physical memory as I have 16GB gaming RAM in my pc and 40GB virtual RAM so I dont think Its realy the memory thats running out... any ideas , has anyone seen this before?
Thanks so much !
heres the code :
Code :
//+------------------------------------------------------------------+
//| Xlr8eSoft Probability Trader.mq4 |
//| Copyright 2010, MetaQuotes Software Corp. |
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Xlr8er"
#property link "http://www.metaquotes.net/"
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
extern int Total_Orders_EA = 1;
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 = 5;
extern double Slippage = 3;
extern int Magic_Number = 10810 ;
extern double Lots = 0.05 ;
int Total = 0;
int init()
{
//----
int Total = 0;
//----
return(0);
}
int start()
{
//-
iCustom(NULL, 0, "MEGATREND PROBABILITY METER II",13,7,0) ;
Print( GetLastError());
string Probability_Value = ObjectDescription("prop_value");
PMI = StrToDouble(StringSubstr(Probability_Value,0,StringLen(Probability_Value)-1));
TI = ObjectDescription("trend_comment_");
Print ("Succesful no 4.5");
buy = StringFind(TI,"LONG",0);
sell = StringFind(TI,"SHORT",0);
Print("BUYSELL",buy, sell);
Print(PMI,Probability_Value );
if(Total_Orders_EA > Total )
{
Print( GetLastError());
if(PMI > Open_Percentage && buy != -1)
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,Ask - Stop_Loss * Point,Ask + Take_Profit * Point,"Xlr8eBot",0,0,Green);
Total ++ ;
}
}
if(Total_Orders_EA > Total)
{
if(PMI > Open_Percentage && sell != -1)
{
OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,Bid + Stop_Loss * Point,Ask - Take_Profit * Point,"Xlr8eBot",0,0,Red);
Total ++ ;
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
So can you please help me to somehow code my EA to know when the trade it entered has closed and has to reinitialise its parameters and set the total trades back to 0 ....
I am also getting the error : Memory handler : cannot allocate 630892 bytes of memory ...
any idea how I can clear the memory my EA uses now and then and re-load it... I do have enough physical memory as I have 16GB gaming RAM in my pc and 40GB virtual RAM so I dont think Its realy the memory thats running out... any ideas , has anyone seen this before?
Thanks so much !
heres the code :
Code :
//+------------------------------------------------------------------+
//| Xlr8eSoft Probability Trader.mq4 |
//| Copyright 2010, MetaQuotes Software Corp. |
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Xlr8er"
#property link "http://www.metaquotes.net/"
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
extern int Total_Orders_EA = 1;
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 = 5;
extern double Slippage = 3;
extern int Magic_Number = 10810 ;
extern double Lots = 0.05 ;
int Total = 0;
int init()
{
//----
int Total = 0;
//----
return(0);
}
int start()
{
//-
iCustom(NULL, 0, "MEGATREND PROBABILITY METER II",13,7,0) ;
Print( GetLastError());
string Probability_Value = ObjectDescription("prop_value");
PMI = StrToDouble(StringSubstr(Probability_Value,0,StringLen(Probability_Value)-1));
TI = ObjectDescription("trend_comment_");
Print ("Succesful no 4.5");
buy = StringFind(TI,"LONG",0);
sell = StringFind(TI,"SHORT",0);
Print("BUYSELL",buy, sell);
Print(PMI,Probability_Value );
if(Total_Orders_EA > Total )
{
Print( GetLastError());
if(PMI > Open_Percentage && buy != -1)
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,Ask - Stop_Loss * Point,Ask + Take_Profit * Point,"Xlr8eBot",0,0,Green);
Total ++ ;
}
}
if(Total_Orders_EA > Total)
{
if(PMI > Open_Percentage && sell != -1)
{
OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,Bid + Stop_Loss * Point,Ask - Take_Profit * Point,"Xlr8eBot",0,0,Red);
Total ++ ;
}
}
//----
return(0);
}
//+------------------------------------------------------------------+