Also . . . . MagicNumber is meant to be an int
extern int MAGIC = 1234;
I WOULD LIKE TO MAKE IT WORK ON MORE THAN ONE CHART AT THE SAME TIME SO I TRYED THIS:
You don't need to make any changes, it will work on multiple charts no problem.
You don't need to make any changes, it will work on multiple charts no problem.
Oh thank you guys!!
I made the changes but... it still does not work on the other charts!!
Any clue??
You don't need to make any changes, it will work on multiple charts no problem.
if (OrdersTotal() == 0){must become
int count=0 for(iPos = OrdersTotal()-1; iPos >= 0 ; iPos--) if ( OrderSelect(iPos, SELECT_BY_POS) // Only my orders w/ && OrderMagicNumber() == magic.number // my magic number && OrderSymbol() == Symbol() // and my pair. ){ count++; } if (count == 0){ :
Not without magic numbers. Both in the order send and
must become
It gives me several errors.. could you paste the hole code please, how it all should be??
THANK YOU
No Slaves here, learn to code or pay someone. We're not going to code it FOR you. We are willing to HELP you.
But my dear friend... of couse you can do whatever you want... be free please.
What i only wanted to say is that the code you generously served, pasted insted the other, gave some errors and... maybe, you could paste it all together to see about it... pfffff. If you can`t, relax, take it easy.
Thank you.
Not without magic numbers. Both in the order send and
must become
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
HI GUYS!!
I GOT THIS EA FROM HERE:
//+------------------------------------------------------------------+
//| mo_bidir_v0_1.mq4 |
//| |
//| - Works best in 5M timeframe |
//| - Bug fix to stop_loss in line 22 2010.04.07 |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010 - Monu Ogbe"
#define MAGIC 1234
#define IDENT "mo_bidir_v0_1"
extern double lots = 1;
extern double stop_loss = 80; // (8 pips) optimise 50-2000
extern double take_profit = 750; // (75 pips) optimise 50-2000
int last_bar = 0;
int start(){
if (last_bar == Bars) return(0);
last_bar = Bars;
if (OrdersTotal() == 0){
OrderSend(Symbol(), OP_BUY, lots,Ask, 3, Ask - stop_loss * Point, Bid + take_profit * Point, IDENT, MAGIC, 0, Blue);
OrderSend(Symbol(), OP_SELL, lots,Bid, 3, Bid + stop_loss * Point, Ask - take_profit * Point, IDENT, MAGIC, 0, Red);
}
return(0);
}
I WOULD LIKE TO MAKE IT WORK ON MORE THAN ONE CHART AT THE SAME TIME SO I TRYED THIS:
//+------------------------------------------------------------------+
//| mo_bidir_v0_1.mq4 |
//| |
//| - Works best in 5M timeframe |
//| - Bug fix to stop_loss in line 22 2010.04.07 |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010 - Monu Ogbe"
#define IDENT "mo_bidir_v0_1"
extern double MAGIC =1234
extern double lots = 1;
extern double stop_loss = 80; // (8 pips) optimise 50-2000
extern double take_profit = 750; // (75 pips) optimise 50-2000
int last_bar = 0;
int start(){
if (last_bar == Bars) return(0);
last_bar = Bars;
if (OrdersTotal() == 0){
OrderSend(Symbol(), OP_BUY, lots,Ask, 3, Ask - stop_loss * Point, Bid + take_profit * Point, IDENT, MAGIC, 0, Blue);
OrderSend(Symbol(), OP_SELL, lots,Bid, 3, Bid + stop_loss * Point, Ask - take_profit * Point, IDENT, MAGIC, 0, Red);
}
return(0);
}
BUT I RECIVED 3 ERRORS AND DON`T KNOK WHAT TO DO:
'extern' - comma or semicolon expected
'MAGIC' -variable not defined
'MAGIC' -variable not defined
WHAT MAY I DO TO FIX IT??
THANK YOU!!