need coding help please

 
I need help please. I'm a newbie at coding, but have been trading forex for a loooooong time.

With help from the "Expert Advisor Builder" I have constructed the attached EA, which works in testing. The problem is that it doesn't work when placed on several live charts. Because it uses a 4-hr test, it's a long time to see if my corrections fix it, and I'm getting frustrated.

I have renamed the same EA as 5 different names, and placed one on each of 5 different pair charts, all on the same MT4 platform. That didn't work.

Please, can someone look this over and advise me on how to get the code working so I can use it on more than one pair?
 
//+------------------------------------------------------------------+
//| QQE 4hr_15min TESTING                                            |
//| triggers on 4 hour QQE, then uses 15 min QQE to enter trade.     |
//+------------------------------------------------------------------+

#property copyright "Expert Advisor Builder"
#property link      "http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/"





//Check position                 
             bool IsTrade = False;
             for(int i = 0; i < Total; i ++) 
               {                       
                OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
                if(OrderType() <= OP_SELL &&  OrderSymbol() == Symbol()) 
                  {                 
                   IsTrade = True;
                   if(OrderType() == OP_BUY) 
                     {            
//Close                          
//+------------------------------------------------------------------+
//| Signal Begin (Exit Buy)                                           |
//+------------------------------------------------------------------+

To show what a bad expert advisor builder this is i copied a few lines

It is not using the magicnumber of the trades when it checks the open trades

this EA can manage trades you don't want to have changed by this EA

It is counting up checking the trades and in this total loop it will also close trades then it has to count down......

 

And whatever result of Orderselect() we continue executing next block.

LOL

 

As I said, I'm a newbie at coding, and this EA is/was working, so I have attempted to develop it, and when I was stumped, I asked for help on this forum.

Nice try at making fun of my efforts, without actually saying anything that as a newbie I can use. Is the LOL because I asked for help?

I don't want or need to become an expert in coding, I just assumed that a polite ask for assistance to solve a simple error (or two) would actually lead to somebody advising me of where in the code the error is. What deVries typed here effectively DOESN'T help me at all, as I would have to study/practice/experiment for perhaps years to even understand what was said.

Weren't all of you newbies once, and needed just a kind word of assistance to get simple codes working? Please?

 
unclebigpete:


Weren't all of you newbies once, and needed just a kind word of assistance to get simple codes working? Please?

Yes, 4 years ago . . . make some effort to learn . . . you may not want to be an expert, I don't count myself as an expert, but to make a properly functioning EA you WILL need to learn to code properly . . . alternatively you can always ask someone else to do it for you: Jobs
 

Raptor, I AM MAKING AN EFFORT. I just want a working EA that I can further develop AS I LEARN. I had this one working, and then tweaked something and it now doesn't. I've been reading about coding, and I don't have 4 or more years to get up to speed. Just a little actual help please, as what has been said here isn't much help to me.

It's a bit like learning to smoke a cigarette where the advice is 'light it' !

 
unclebigpete:

As I said, I'm a newbie at coding, and this EA is/was working, so I have attempted to develop it, and when I was stumped, I asked for help on this forum.

Nice try at making fun of my efforts, without actually saying anything that as a newbie I can use. Is the LOL because I asked for help?

I don't want or need to become an expert in coding, I just assumed that a polite ask for assistance to solve a simple error (or two) would actually lead to somebody advising me of where in the code the error is. What deVries typed here effectively DOESN'T help me at all, as I would have to study/practice/experiment for perhaps years to even understand what was said.

Weren't all of you newbies once, and needed just a kind word of assistance to get simple codes working? Please?


"it's a long time to see if my corrections fix it, and I'm getting frustrated " quoted from you

This is the problem you have. You are using a "Expert Advisor Builder" ( that is coding a bad way....) for making your EA's.

When this program is making your crap EA then you have not learn the knowledge to see what is wrong with the coding.

If you started yourself making EA's without automatic EA Builders

then you find the problems more easier by knowing where to look at in the first place

if you have the programlines from an EA made or not made by you....

And yes it takes time to learn but if you can see yourself what the error is then your frustration wouldn't be that big

who wants to use crap STOP USING THAT EA BUILDER ....

 
unclebigpete:

Just a little actual help please,

OK, a little help . . .

Find this part in your code, and change it to this . . .

//+------------------------------------------------------------------+
//| Variable End                                                     |
//+------------------------------------------------------------------+
//Check position                 
             bool IsTrade = False;
             for(int i = Total -1; i >= 0; i --) 
               {                       
               if( OrderSelect(i, SELECT_BY_POS, MODE_TRADES) &&
                  OrderType() <= OP_SELL &&  OrderSymbol() == Symbol()) 

This doesn't check the Magic Number . . you will need to add that in if you want to place manual orders on the same pairs or if you want to run on different timeframes on the same pair at the same time . . . do you ?

Bars is not reliable, it's a bad idea to use Bars . . you should use Time instead.

Your Slippage isn't adjusted for 4/5 Digit Brokers . . nor is your TP or SL.

If you make your SL small you will get error 130 because you aren't checking if it's too close or allowing for Spread.

Is your Broker an ECN Broker ? you can't set SL & or TP when you place an Market order with an ECN Broker, you have to code a OredrModify() to add the SL & or TP after the order is placed . . .

Shall I go on ? this is BASIC stuff . . . these points come up on this Forum day in, day out . . .

And you don't understand much of this because you haven't actually coded anything . . . you have used someone else's code . . "Expert Advisor Builder". There is only one short cut: Jobs

 
unclebigpete 2012.05.22 10:19

As I said, I'm a newbie at coding, and this EA is/was working, so I have attempted to develop it, and when I was stumped, I asked for help on this forum.

Nice try at making fun of my efforts, without actually saying anything that as a newbie I can use. Is the LOL because I asked for help?

I don't want or need to become an expert in coding, I just assumed that a polite ask for assistance to solve a simple error (or two) would actually lead to somebody advising me of where in the code the error is. What deVries typed here effectively DOESN'T help me at all, as I would have to study/practice/experiment for perhaps years to even understand what was said.

Weren't all of you newbies once, and needed just a kind word of assistance to get simple codes working? Please?

Dear unclebigpete,

My apology if you get offended. I was not loling at you. I was and still loling at "Expert Advisor Builder". I was newbie 4 years ago, asked lots of stupid questions, - heck I'm still learning now - some forumers here correct me and my code and I accept it, I learn from other'd code as well - ask RaptorUK about that - he corrected me last Sunday and that history download thing.

Put it this way, if your EA run on 4hr data, then you really are have to wait. One full day has only 6 candle/bar on 4 hr. Another thing, you said you've been trading for a long time and I assume that you trading manually and I assume this EA is based on you strategy. Well, isn't manual trading require patience ?, same thing with this EA then.

you said this ...

unclebigpete 2012.05.22 10:52

Raptor, I AM MAKING AN EFFORT. I just want a working EA that I can further develop AS I LEARN. I had this one working, and then tweaked something and it now doesn't. I've been reading about coding, and I don't have 4 or more years to get up to speed. Just a little actual help please, as what has been said here isn't much help to me.

It's a bit like learning to smoke a cigarette where the advice is 'light it' !

Then my Q is, Whoa ..., which part of it that you've tweaked ? Now you asked ask us to find the err and fix it.

I look at your code later, and btw, the .ex file is compiled file which doesn't help.

:)

 

Lets take an example of why "your" code is bad . . . .

Ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, StopLossLevel, TakeProfitLevel, "Sell(#" + MagicNumber + ")", 
   MagicNumber, 0, DeepPink);
                   
if(Ticket > 0) 
   {
   if(OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) 
      {
      Print("SELL order opened : ", OrderOpenPrice());
      if(SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Open Sell");
      } // if(Order...

   else                                 // <---  this else is in relation to the OrderSelect,  so when the OrderSelect fails the error stored in GetLastError is updated
      {
      Print("Error opening SELL order : ", GetLastError());  // <--- this will give you Error 0 and you will be scratching your head
      } // else 
   } // if(Ticket... 

the error reported is in relation to the OrderSelect NOT The OrderSend . . .

It should be done like this . . .

Ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, StopLossLevel, TakeProfitLevel, "Sell(#" + MagicNumber + ")", 
   MagicNumber, 0, DeepPink);
                   
if(Ticket < 0) 
   {
   Print("Error opening SELL order : ", GetLastError());  // <--- this will give you Error that relates to the OrderSend
   } // if(Ticket... 

else                                 // <---  this else is in relation to the if(Ticket < 0)
   {
   if(OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) 
      {
      Print("SELL order opened : ", OrderOpenPrice());
      if(SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Open Sell");
      } // if(Order...
   } // else 
 
onewithzachy:

Dear unclebigpete,

My apology if you get offended. I was not loling at you. I was and still loling at "Expert Advisor Builder". I was newbie 4 years ago, asked lots of stupid questions, - heck I'm still learning now - some forumers here correct me and my code and I accept it, I learn from other'd code as well - ask RaptorUK about that - he corrected me last Sunday and that history download thing.

We are all still learning . . . and even if we weren't we are all humans and all of use make mistakes . . . me especially. The only person that doesn't make a mistake is the person that does nothing . . .

By the way . . . why wait to test your code . . . test it in the tester . . . the Strategy Tester. ;-)

Reason: