I NEED 'The Count'! I know its not Halloween but has anyone seen him around here lately?

FourX
1320
FourX  

I've literally spent HOURS trying to find the imbalanced parenthesis error.

I put all of it into Word and it confirms it with a count of:

300 for the Left parenthesis (

and 296 ) Right hand parenthesis

I've removed all extra ones that I added for mathematical grouping and priorities and anything and everything else that I can think of including checking the included files, but still no luck!

I'm hoping that one of you experienced eagle eyed MQL4 gurus can spot it, because I certainly can't find it )< 8(

Thanks for any and all assistance with this lame problem!

I had the entire EA inserted here but when I try to upload the EA it says that the 'text is to long'

I tried to upload the mq4 file but it is telling me that the text is to long )< 8(

Just shortened the 'text' severely and will try the upload now.

Below is the NewBar.mqh file that BarrowBoy made for me to signal the start of the new bar. I wasn't having much luck with the actual included file, so I was trying his original code to put directly into the EA instead.

It is also attached here: NewBar.mqh

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//|                                                                  |
//| Copyright © 2010 BarrowBoy @ MQL4.Com            for FourX       |
//|   ALL RIGHT RESERVED !       http://4-X.CA       NewBar.mq4      |
//|                                              2010-05-17 @ 10:01  |
//|                                                                  |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//|                                            defines               |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

// #define MacrosHello   "Hello, world!"
// #define MacrosYear    2005


//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//|                                           DLL imports            |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#import "user32.dll"
   int      SendMessageA(int hWnd,int Msg,int wParam,int lParam);

// #import "my_expert.dll"
//   int      ExpertRecalculate(int wParam,int lParam);
// #import


//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//| EX4 imports                                                      |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 #import "stdlib.ex4"
   string ErrorDescription(int error_code);
// #import


//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

// From the 'New' button on the editor, create a new Include file 
//       (which will be created in the experts\include folder)
// Then paste this in:


int lastbar;

//-------------------------------------

bool isNewBar() 
{ 
datetime curbar = Time[0]; 

  if(lastbar != curbar) 
   { 
    lastbar = curbar; 
     return (true); 
      } 
      else 
      { 
    return(false); 
   } 
}

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/*
Below is the version to embed into the EA directly.
I can't get the included 'NewBar.mqh  ===> isNewBar(); to work so am trying the one added into the EA.


static datetime LastTradeBarTime;

int init()
  {
//----
  LastTradeBarTime = Time[1]; // initialise the variable
//----
   return(0);
  }

start()
{
  // Do <any tick> code here such as trailing stops etc


  if (LastTradeBarTime == Time[0]) return(0); // Not <first detected tick> on this bar so quit

  else LastTradeBarTime = Time[0]; // and continue

  // Do <once per bar> trading stuff here




   return (0);
  }
*/

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

/*
and save it - you can then use the isNewBar in any EA that has a reference to your include file at the top, e.g.

#include <FourXFunctions.mqh> 

Do not compile includes, unlike libraries ;)

Good Luck

- BB -
*/
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Files:
[Deleted]  

Is this it??

Print("iRetractmentMax * Point = ",(iRetractmentMax * Point);

TBH I haven't added the includes so it won't compile for me... but I think this line is missing a bracket.


EDIT: and just to clarify that is line 117

[Deleted]  

Doug I took a look and tried to sift through that code but honestly man it seems horrendous. You got left brackets where you don't need any so I can't tell if right brackets are placed to close the unneeded left brackets or if the logic itself is flawed.

My opinion -> you need to go through this code line by line and re-do it, clean it up. I mean just trying to wade through 40 line block of code at the beginning of the start() call is trouble already:

  // isNewBar : Do <any tick> code here such as trailing stops etc
   {                             // <- why is this left-bracket here?
   if (LastTradeBarTime == Time[0]) return(0); // Not <first detected tick> on this bar so quit
   else LastTradeBarTime = Time[0]; // and continue
   }                             // <- why is this right-bracket here?
// Do <once per bar> trading stuff here
//   if(isNewBar()
     adTradeOrders[0] = OrdersTotal();
         Print("adTradeOrders = ",adTradeOrders,".  OrdersTotal() = ",OrdersTotal());
      iOrders = ArraySize(adTradeOrders);
      iOrders = ArraySort(adTradeOrders, WHOLE_ARRAY, 0, MODE_ASCEND);
         Print("iOrders = ",iOrders);
      {          // <- why is this left-bracket here?
      for (int i = 0; i < iOrders; i ++)
         {
         OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
            {    // <- why is this left-bracket here?
//         if(isNewBar());
         if(isNewBar()) IsTrade = True;
         if(OrderType() == OP_BUY && OrderSymbol() == Symbol())
            if(iRetractmentMax * Point > MathAbs(OrderTicket() - Ask)) Order = SIGNAL_CLOSEBUY; //=3; //=
               Print("OrderType() = ",OrderType());
               Print("iRetractmentMax * Point = ",(iRetractmentMax * Point);
               Print(("MathAbs(OrderTicket() - Ask)) = ",(MathAbs(OrderTicket() - Ask));
             OrderClose(OrderTicket(), OrderLots(), Ask, iSlippage, LimeGreen);
            }                             // <- which left-bracket is this intended to close?
            if(OrderType() == OP_SELL && (iRetractmentMax * Point) > (MathAbs(OrderTicket() - Bid))) Order = SIGNAL_CLOSESELL; // = 4; //
               OrderClose(OrderTicket(), OrderLots(), Bid, iSlippage, Magenta);
         }                    // <- which left-bracket is this intended to close?
       return;
      }          // <- which left-bracket is this intended to close?
FourX
1320
FourX  

Hi All,

I have no problems with the the (logical) braces: { & }, its the parenthesis: ( & ) that are unbalanced.

I did quite a bit of blocking out different sections with /* .& . */ though and had no luck. Of course, unless this is done properly it just sets off other alarms for problems created by this technique.

I then tried going though most of it line by line and 'remed' each line out with //

Re:

// <- which left-bracket is this intended to close?

I've gone through it trying to find and balance these out already, though I'm not saying that I have it really well cleaned up and all 'neat & tidy' though. I did have problems with these being out of balance as well with the 'lack of proper program ending' error message. But I got that part solved. Most of the extra 'messy stuff' is extra documentation for the NuB that I am and is there to track program flow, execution and syntax. Some of it is from the stuff that I got from BarrowBoy trying to confine some actions that I need to only be carried out at the start of a new bar, which I have (still) been having difficulties with.

FourX
1320
FourX  
Viffer:

Is this it??

Print("iRetractmentMax * Point = ",(iRetractmentMax * Point);

TBH I haven't added the includes so it won't compile for me... but I think this line is missing a bracket.


Hi Viffer,

Yep, it's short one right parenthesis. Thanks: That;s one down and 3 to go!

Re Compilation:

2 of the included files are standard MQL/MT 4 included files.

The 'CurrencyPairs.mqh isn't being used anymore in so that line can be removed or remmed out.

The NewBar 3.mqh just needs to be renamed to NewBar.mqh. But I can't get it to work, so has had most of the functions from it: ' isNewBar(); ' have been removed anyway.

Thanks for your help. (< 8)

------------------------------------------------------------------------------------------------------------

FourX
1320
FourX  
FourX:

It really doesn't help that I can barely make out and read the monitor.

I've done just about everything that I can with the current setup.

I have a very high quality and expensive professional graphics monitor but found out the hard way that the electrical outlet wasn't grounded. This past winter when the air was so dry (5% ~ 10% Relative Humidity) and thus generates static electricity like crazy, my cat loaded with it rubbed up against the monitor and zapped the vertical sync )< 8(

My visual impairments aren't getting any better with age.

I likely need new glasses, but that can't happen for a while.

[Deleted]  
FourX:
That;s one down and 3 to go!

I thought we were only looking for 1... I will take another look.

V

[Deleted]  
Line 118 - 2 missing

Print ( ("MathAbs(OrderTicket() - Ask)) = ",(MathAbs(OrderTicket() - Ask));

Missing closing / 2 x pointless openinig


line 330

if(isNewBar()

missing close



That's them all but worried about line 101

// if(isNewBar()

if you ever uncomment it.


Personally, I compile all the time, everytime I enter a new block, so that if there is a problem, I know where to look... and if worst comes to worst, can always undo until it compiles again