Help finding unbalanced left parenthesis - page 5

 

Use the print statment to see the values that were checked that allowed the order to be sent.

if(flag==1)  {
      Print("MAFast1=",MAFast1,"  MAFast2=",MAFast2","   MA....", MAFast3 /*and so on  */); 
      Ticket_L = OrderSend(Symbol(),OP_BUY,Lots,Ask,Slip,0,0,Comments,MAGIC,0,Red);
    }
 

no offense taken by the chinese, i just dont read chinese and it tends to confuse me... ;)

regarding your question about how is it taking a long position, let me see if i can explain it.

if(flag==1)  {  
      Ticket_L = OrderSend(Symbol(),OP_BUY,Lots,Ask,Slip,0,0,Comments,MAGIC,0,Red);
    }

if the comparisons end up setting flag to a one, the code between the above curly braces {} will execute.

otherwishe, if flag does not contain a one, the program will skip over the curly braces and everything in between them and resume executing code after the closing curly brace.

see what i mean?

zero/.

 
Thank you i will add it and see . I really appreciate your helps.
 

my best wishes to you, ericman.

zero/.

 
smoknfx:

no offense taken by the chinese, i just dont read chinese and it tends to confuse me... ;)

regarding your question about how is it taking a long position, let me see if i can explain it.

if the comparisons end up setting flag to a one, the code between the above curly braces {} will execute.

otherwishe, if flag does not contain a one, the program will skip over the curly braces and everything in between them and resume executing code after the closing curly brace.

see what i mean?

zero/.

Thanks for explaining . I feel my brain is making dopamine each time you are solving my doubt and question. I try to keep on coding. Thanks.
 

ericman,

this is what i do for fun.

my trading code is way finished.

i am just killing time while i run my own live trades.

btw, i am gonna be way phat rich... like, billions, you know.

dig it.

zero/.

Video: Marilyn Manson - New @#$&%%

 
smoknfx:

ericman,

this is what i do for fun.

my trading code is way finished.

i am just killing time while i run my own live trades.

btw, i am gonna be way phat rich... like, billions, you know.

dig it.

zero/.

Video: Marilyn Manson - New @#$&%%


why are you showing Marling Manson videos lol I thought you sent me your EA video or something lol... Well Thanks in any way i m gonna keep Coding lol

Try to think in a easy way besides wont last i guesss..

 

Since this thread has be become a teaching programming techniques I thought I would change the code a tiny bit to aid the process of understanding why code might not work as expect or debugging.

#define MAGIC  4649        

// parameter
extern double Lots = 1.0;     //
extern int Slip = 10;         //
extern string Comments =  ""; //

extern int FastMA1_p = 34;
extern int SlowMA1_p = 34;
extern int modeMA1 = MODE_SMA;
extern int modeMA2 = MODE_EMA;
extern int MA1Cross_Timeframe = PERIOD_M15;
extern int FastMA2_p = 68;
extern int SlowMA2_p = 68;
extern int CCI_p = 20;
extern int CCI_Buy_Point = 100;
extern int CCI_Sell_Point = -100;
extern int CCI_Timeframe = PERIOD_M30;
extern int Band_p = 6;
extern int Band_Timeframe = PERIOD_M15;



//variables//
int Ticket_L = 0; 
int Ticket_S = 0; 
int Exit_L = 0;   
int Exit_S = 0;   




int start()
  {


double MAFast1 = iMA(NULL, MA1Cross_Timeframe, FastMA1_p, 0, modeMA2, PRICE_CLOSE, 0);
double MAFast2 = iMA(NULL, MA1Cross_Timeframe, FastMA1_p, 0, modeMA2, PRICE_CLOSE, 1);
double MASlow1 = iMA(NULL, MA1Cross_Timeframe, SlowMA1_p, 0, modeMA1, PRICE_CLOSE, 0);
double MASlow2 = iMA(NULL, MA1Cross_Timeframe, SlowMA1_p, 0, modeMA1, PRICE_CLOSE, 1);
    
double MAFast3 = iMA(NULL, MA1Cross_Timeframe, FastMA2_p, 0, modeMA2, PRICE_CLOSE, 0);
double MAFast4 = iMA(NULL, MA1Cross_Timeframe, FastMA2_p, 0, modeMA2, PRICE_CLOSE, 1);
double MASlow3 = iMA(NULL, MA1Cross_Timeframe, SlowMA2_p, 0, modeMA1, PRICE_CLOSE, 0);
double MASlow4 = iMA(NULL, MA1Cross_Timeframe, SlowMA2_p, 0, modeMA1, PRICE_CLOSE, 1);
    
     
double cci1 = iCCI(NULL, CCI_Timeframe, CCI_p, PRICE_CLOSE, 0);
double cci2 = iCCI(NULL, CCI_Timeframe, CCI_p, PRICE_CLOSE, 1);
double cci3 = iCCI(NULL, CCI_Timeframe, CCI_p, PRICE_CLOSE, 2);
   
double bands_upper1 = iBands(NULL, Band_Timeframe, Band_p,1, 0, PRICE_CLOSE, MODE_UPPER, 1);
double bands_upper2 = iBands(NULL, Band_Timeframe, Band_p,1, 0, PRICE_CLOSE, MODE_UPPER, 2);
double bands_lower1 = iBands(NULL, Band_Timeframe, Band_p,1, 0, PRICE_CLOSE, MODE_LOWER, 1);
double bands_lower2 = iBands(NULL, Band_Timeframe, Band_p,1, 0, PRICE_CLOSE, MODE_LOWER, 2);

int flag=0;

     

   //Long position entry 
   
flag = 0 ; //ensures that code in development that might appear before this code has not corrupted what we need the status of flag to be

if(MAFast1>MASlow1 && MAFast3>MASlow3 && cci3<100 && cci2>=100 && cci1>100) flag=flag+1; //flag += 1; would do the same thing

if(MAFast1>MASlow1 && MAFast4<MASlow4 && MAFast3>MASlow3 && cci1>100) flag=flag+10; 

if(MAFast2<MASlow2 && MAFast1>MASlow1 && MAFast3>MASlow3 && cci1>100) flag=flag+100;

if(flag>0)  {
      Print("Flag=",Flag) ; //Now we can see which conditions were satisfied  
      Ticket_L = OrderSend(Symbol(),OP_BUY,Lots,Ask,Slip,0,0,Comments,MAGIC,0,Red);
    }
    

    
     
   return(0);
  }
 
ericman:


why are you showing Marling Manson videos lol I thought you sent me your EA video or something lol... Well Thanks in any way i m gonna keep Coding lol

Try to think in a easy way besides wont last i guesss..


i enjoy my music while i work.

good luck to you with your coding.

ickyy has the wheel now.

my best wishes to you.

zero/.

 
I don't accept the assigned responsibility.