How to code? - page 72

 

Help with EA errors

Hi, I need help with the following EA. This is my frist EA so be (gentle) please.

When I compile the file I get two warning (s) that both read:

'TotalOpenOpenOrders'-expression on global scope not allowed

This warning come after the word Max in the file.

// init variable when the expert advisor first starts running

if (init_variables == true)

{

PreviousBar = Time[0]; // record the current candle/bar open time

// place code here that you only want to run one Time

init_variables = false; // change to false so we only init

// variable once

}

// perform analysis and open orders on new candle/Bars

if(NewBar() == true)

{

// only perform analysis and close order if we only have one order Open

if(TotalOpenOrders() == Total_Open_Orders && SelectTheOrder() == True)

{

if(OrderType() == OP_BUY && TrendDetection() == BEAR)

{

OrderClose(OrderTicket(),OrderLots(),Bid,Slippage,Order_Arrow_Color);

}

if(OrderType() == OP_SELL && TrendDetection() == BULL)

{

OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,Order_Arrow_Color);

}

}

// only perform analysis and open new order if we have not reached

// our Total_Open_Orders Max

if(TotalOpenOrders() < Total_Open_Orders)

{

// open buy

if(TrendDetection() == BULL)

{

// open Order

OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,Stop_Loss*Point,Take_Profit

*Point,Order_Comment,Magic,0,Order_Arrow_Color);

}

//open sell

if(TrendDetection() == BEAR)

{

// open Order

OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,Stop_Loss*Point,Take_Profit

*Point,Order_Comment,Magic,0,Order_Arrow_Color);

}

}

// when back testing only display chart info every

// candle/bar sowe do not slow down back tests

if(IsTesting() == true)

{

Display_Info();

}

}

// when not back testing display chart info every tick

if(IsTesting() == false)

{

Display_Info();

}

return(0);

}

 

Help with EA errors

Whammo,

Where is your start() function?

Operations, except variable initialization, generally have to be inside a function.

Which EA are you copying? (There are some ideas I would like to examine in there.)

Big Be

 

To Big Me

Hi, I solved my problem using iMaOnArray. Thanks for your help!

By the way if U could post any EA, that would open multiple positions, with the part of code U were refering to a few days ago - it would be great.

Regards,

J

 

Can anyone let me know how can i change this code

SetIndexStyle(0,DRAW_ARROW);

SetIndexArrow(0, 233);

SetIndexStyle(1,DRAW_ARROW);

SetIndexArrow(1, 234);

SetIndexStyle(2,DRAW_ARROW);

SetIndexArrow(2, 233);

SetIndexStyle(3,DRAW_ARROW);

SetIndexArrow(3, 234);

to change arrow shapes to dots, circle, and other available shapes

In fact, I need to know the codes for such signals

 

Give this a try

"This is the mt4 site that contains the info that you are after, the arrows and shapes are listed with the number to enter for the required object.Wingdings - MQL4 Documentation

 

Help me please!

Everyone,

I have a question:

1)I have this indicator. Every bar, I need to delete that indicator, and attach it to the chart again. If I don't do this, it shows different results. I am trying to code an EA for this indicator, and I don't know how to make the EA take off the indi. and attach it again, so that the data refreshes. I tried RefreshRates(); and it didn't work either. What could be the problem?

Thank you!!!!!!!!!!!!

 

Which indicator?

 

Lukas1 MA-4Hcolormodified

 

Post Indicator

Dan can you post the indicator I do not have that one in my collection. Thanks. Jatki24300

 
jatki24300:
Dan can you post the indicator I do not have that one in my collection. Thanks. Jatki24300

Does anyone know how to fix the problem?

Reason: