MMA_Breakout_strategy_volume I (without MM or MF) - coded by WhooDoo22 - page 2

 
Again, there are multiple ways to select orders, for instance, I could use Boolean to check if an order is open or closed. Example:  Order is sent, five Boolean are set to true. As the moving averages begin to cross, the Boolean will be set to false. If certain Boolean variables are true and certain moving averages cross, certain Boolean variables are declared false and a certain lot of the order is closed.  There are other ways, but I have not given it much thought. I simply wish to provide you a solution. I hope it was satisfactory. I believe I would find a more simple way of doing this, but again, I have not given it much thought. It is still important, but not as difficult to code as MF or MM in this strategy. Thank you.
 
If I have a Live account that I have traded with before and there are no open live orders currently on it . . . if I run your EA on it on EURUSD M30 what will happen ?  will it take trades ?
 

By the way,  I ran your EA in the Strategy Tester and ended up with a 11GB log file of errors . . . for example . . .

 

23:08:49 2007.05.06 22:00  MMA_Breakout_strategy_volumeaIk_withouteMMjoreMF_u-rcodedmbywWhooDoo22 EURUSD,M30: OrderModify error 1

23:08:49 2007.05.06 22:00  MMA_Breakout_strategy_volumeaIk_withouteMMjoreMF_u-rcodedmbywWhooDoo22 EURUSD,M30: close #6 buy 0.01 EURUSD at 1.36028 sl: 1.31028 at price 1.35960

23:08:49 2007.05.06 22:01  MMA_Breakout_strategy_volumeaIk_withouteMMjoreMF_u-rcodedmbywWhooDoo22 EURUSD,M30: unknown ticket 6 for OrderModify function

can't modify ticket #6 as it has just been closed . . . .
 
WhooDoo22:
I believe there are multiple ways to select orders, All methods of selecting orders should use the OrderSelect() function. With that said, I do not see why this would fail because the EA clearly performs the OrderClose() function for all orders without error in the strategy tester.

Your orderClose clearly is not working. If you had checked your return codes you would know that. Your orderSelect is not working, but you don't check.

if I is not a ticket number then your orderSelect fails and so does everything else.

if I is a ticket number, the next ticket number is NOT i+1 (except in the tester)

   OrderSelect(i,SELECT_BY_TICKET,MODE_TRADES);
   if(OrderType()==OP_BUY)                                                                     {
   if(OrderLots()==0.04)                                                                       {
   if(OrdersTotal()>0)                                                                         {
   if(iMA(NULL,0,1,0,MODE_SMMA,PRICE_CLOSE,1)<(iMA(NULL,0,25,0,MODE_SMMA,PRICE_CLOSE,1)))      {  
     {
      OrderClose(i,0.01,Bid,30,CLR_NONE); 
      i++;
     }
     }}}}
     
   OrderSelect(i,SELECT_BY_TICKET,MODE_TRADES);
   if(OrderType()==OP_BUY)                                                                     {
   if(OrderLots()==0.03)                                                                       {
   if(OrdersTotal()>0)                                                                         {
   if(iMA(NULL,0,1,0,MODE_SMMA,PRICE_CLOSE,1)<(iMA(NULL,0,50,0,MODE_SMMA,PRICE_CLOSE,1)))      {  
     {
      OrderClose(i,0.01,Bid,30,CLR_NONE); 
      i++;
     }
     }}}}
     
   OrderSelect(i,SELECT_BY_TICKET,MODE_TRADES);
   if(OrderType()==OP_BUY)                                                                     {
   if(OrderLots()==0.02)                                                                       {
   if(OrdersTotal()>0)                                                                         {
   if(iMA(NULL,0,1,0,MODE_SMMA,PRICE_CLOSE,1)<(iMA(NULL,0,100,0,MODE_SMMA,PRICE_CLOSE,1)))     {  
     {
      OrderClose(i,0.01,Bid,30,CLR_NONE); 
      i++;
     }
 

Simon,

If I have a Live account...

RE: I highly do not recommend you running volume I on a live account balance! Of course, the choice is yours to make, but on your behalf, I strongly do not recommend you to run it on live account until its evolution from volume I to II has been complete. Volume I is still in its development and should not be run until it has been completely coded. I am not sure what would happen because I have not tested it myself on a LIVE account. I understand its lack of completion and have chosen to meet it's essential demands before initiating LIVE account testing.


By the way,..

RE: I believe I understand what is going on right off the bat on this error... This error reflects an error within the "EMERGENCY SL" code block. I never really focused my power on this, as it is not as difficult to code. I partly coded it and did not complete it's maturity. The "EMERGENCY SL" code block lacks important tailoring. I am confident that if you completely removed both SELL and BUY "EMERGENCY SL" code blocks, you would not receive the 11 gig error list. The reason why it is 11 gigs to begin with is because I believe it is the same error repeating itself over and over through course of history being tested.

Thank you.


William,

I will say, I do not have as much history discussing code with you as Simon, but I wish to continue forward with your post (thank you for your post! It is welcomed.).

What is it you wish to see in Volume I/II?

I am strictly running tests and adding essential code for testing in order to guarantee its trading value. I will then fine tune the what is left of code issues to insure safe trading on LIVE/DEMO.

Thank you.

 
RaptorUK:
If I have a Live account that I have traded with before and there are no open live orders currently on it . . . if I run your EA on it on EURUSD M30 what will happen ?  will it take trades ?

WhooDoo22:

Simon,

If I have a Live account...

RE: I highly do not recommend you running volume I on a live account balance! Of course, the choice is yours to make, but on your behalf, I strongly do not recommend you to run it on live account until its evolution from volume I to II has been complete. Volume I is still in its development and should not be run until it has been completely coded. I am not sure what would happen because I have not tested it myself on a LIVE account. I understand its lack of completion and have chosen to meet it's essential demands before initiating LIVE account testing.


The point I was trying to make and encourage you to look at is that if there is any account history these lines in your code will prevent any trades being taken . . .

   if(OrdersHistoryTotal()==0)                                                                 
      {
      if(OrdersTotal()<MaxOrders)  
   if(OrdersHistoryTotal()==0)                                                                 
      {
      if(OrdersTotal()<MaxOrders)  

 
The other places where an order is placed using OrderSend() is where there is an existing Order open . . . .  so if there are any old orders in the History your EA will not place any trades ever . . .  if you had tested your code on Demo or Live you would probably have discovered this.

 

Simon,

The point I was trying to...

RE: Understood. Do you believe it possible to use the OrderSelect() function to search for a unique ticket variable, then below will lie the code block containing the "if (OrdersHistoryTotal()==0){". Would this not work BECAUSE the OrderSelect() function selects the unique ticket variable "ticket" and the OrdersHistoryTotal() function is searching trade history of the unique ticket variable only, because of the OrderSelect() function above. The "if statement" is only searching for orders in history for a specific variable, the unique ticket variable.

//*************************
// BUY ORDER OPEN SECTION ;
//*************************

   OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES);
   if(OrdersHistoryTotal()==0)                                                                 {
   if(OrdersTotal()<MaxOrders)                                                                 {
   if(iMA(NULL,0,1,0,MODE_SMMA,PRICE_CLOSE,2)<(iMA(NULL,0,200,0,MODE_SMMA,PRICE_CLOSE,2)))     { 
   if(iMA(NULL,0,1,0,MODE_SMMA,PRICE_CLOSE,1)>(iMA(NULL,0,200,0,MODE_SMMA,PRICE_CLOSE,1)))     { 
     {
      ticket=OrderSend(Symbol(),OP_BUY,0.05,Ask,30,0,0,"",0,0,Blue);    
      i++;
     }
     }}}}

Thank you.

 
WhooDoo22:

Simon,

The point I was trying to...

RE: Understood. Do you believe it is possible to use the OrderSelect() function to search for a unique ticket variable, below will lie the code block containing the "if OrdersHistoryTotal()==0{". Would this not work BECAUSE the OrdersHistoryTotal() function is searching for previous trades of the unique ticket variable only? The "if statement" is only searching for orders in history for a specific variable, the unique ticket variable.

Thank you.

I think you are getting a little confused . . .  you said  "Would this not work BECAUSE the OrdersHistoryTotal() function is searching for previous trades of the unique ticket variable only?"  this is incorrect,  check the Documentation,  OrderHistoryTotal() does this . . .

"Returns the number of closed orders in the account history loaded into the terminal. The history list size depends on the current settings of the "Account history" tab of the terminal."


it has nothing to do with any ticket numbers or ticket variables or Magic Numbers or anything else . . .  it returns the Total number of trades in the History pool . . . the only limiting factor is what you chose to show in the Account history tab . . .   All History,  Last 3 months,  Last month or  Custom period.
 
Another point . . .  if I have been using your EA and it has a trade placed . . . . then I need to shut down my PC for a couple of minutes,  when I start MT4 back up and your EA starts it will never find the open Order   . . .   all your OrderSelect() calls are select by ticket . . .  either using your ticket variable or your  i  variable,  neither of which have any way of holding the number of my open order's ticket number. 
 

Simon,

I think you are getting a little confused . . .

RE: Volume II must begin the order send process based on a condition. Once the first order has been sent (based on the condition), the OrderClose() function blocks execute all future trades. Please try to think of this as a cycle. Get the ball rolling based on the condition, then the cycle is initiated once the first order (ball roller order) has been closed. The cycle continues crunching numbers and checking for active conditions UNTIL future conditions are met.

Thank you