• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 8:29am
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 8:29am
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

Charts, Charts, Charts! 1 reply

Breaking news is interfering with my trading 11 replies

Does anybody check charts and trade on iPhone or other smart phone? 19 replies

Other source for UBS FX Research other than Oanda? 2 replies

How to use mt4 with other charts 0 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
  • 1
Attachments: EA interfering with other charts
Exit Attachments

EA interfering with other charts

  • Post #1
  • Quote
  • First Post: Feb 27, 2009 10:48am Feb 27, 2009 10:48am
  •  Arnold49
  • | Joined Apr 2008 | Status: Member | 294 Posts
Hi,
please could someone tell me why the following code alters prices on other charts which the EA isn't attached to? it basically uses a moving average as a SL,
I thought the line "if (OrderSymbol() == Symbol())" made it chart specific?

thanks.

int totalorders = OpenOrders;

for(int i=OrdersTotal()-1;i>=0;i--)

{
OrderSelect(i, SELECT_BY_POS,MODE_TRADES);
if (OrderSymbol() == Symbol())

{
if ( OrderType() == OP_BUY )
{
sl=movavg;
OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,Green);
}
if ( OrderType() == OP_SELL)
{
sl=movavg+(Spread*10)*Point;
OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,Green);
}
}
}
//----
}
  • Post #2
  • Quote
  • Feb 27, 2009 11:09am Feb 27, 2009 11:09am
  •  lohikeitto
  • | Joined Nov 2008 | Status: Member | 41 Posts
You need to use one more condition to specify a trade by magicnumber.

if(OrderMagicNumber() == MAGIC)

Some EAs don't add magicnumber to the ticket when they send open order.
(If they don't, magicnumber become 0 that is the same as manual trades.)

In this case, you can solve it by adding magic number.

// define Magic Number first like this
int MAGIC = 1234567;

// add Magic Number to order section like this
OrderSend(Symbol(), ............,MAGIC, ....);
 
 
  • Post #3
  • Quote
  • Feb 27, 2009 11:13am Feb 27, 2009 11:13am
  •  Arnold49
  • | Joined Apr 2008 | Status: Member | 294 Posts
Quoting lohikeitto
Disliked
You need to use one more condition to specify a trade by magicnumber.

if(OrderMagicNumber() == MAGIC)

Some EAs don't add magicnumber to the ticket when they send open order.
(If they don't, magicnumber become 0 that is the same as manual trades.)

In this case, you can solve it by adding magic number.

// define Magic Number first like this
int MAGIC = 1234567;

// add Magic Number to order section like this
OrderSend(Symbol(), ............,MAGIC, ....);
Ignored

thanks, but this EA manages trades only , it doesn't open them, so I can't really use magic no.s
 
 
  • Post #4
  • Quote
  • Feb 27, 2009 11:27am Feb 27, 2009 11:27am
  •  lohikeitto
  • | Joined Nov 2008 | Status: Member | 41 Posts
Arnold49,

Ok, if so, OrderSymbol() == Symbol() does not manage trades only on the chart the EA is attached.

If you attach it on EURUSD chart and you are opening 5 other EURUSD charts, it will manage trades that is opened on all other 5 charts also.
 
 
  • Post #5
  • Quote
  • Feb 27, 2009 11:42am Feb 27, 2009 11:42am
  •  Arnold49
  • | Joined Apr 2008 | Status: Member | 294 Posts
I had it on GBP/JPY it adjusted the sell trade that was there and, at the same time time it adjusted a GBP/USD chart position, incidently it set them at the same value,

are you saying "if (OrderSymbol() == Symbol())" will not make it chart specific?

thanks,
Steve.
 
 
  • Post #6
  • Quote
  • Feb 27, 2009 12:16pm Feb 27, 2009 12:16pm
  •  lohikeitto
  • | Joined Nov 2008 | Status: Member | 41 Posts
I can't say anything certain with only a piece of code above and without knowing what settings the management EA have, but,

Quote
Disliked
are you saying "if (OrderSymbol() == Symbol())" will not make it chart specific?

Yes, It's not at least "chart specific" but only "symbol specific".

I don't think it will manage GBP/USD trades when you are attaching it to only GBP/JPY chart (if the code above is the only order modify section, of course).

Isn't there a possibility that other EA have modified it casually?
 
 
  • Post #7
  • Quote
  • Edited at 12:37pm Feb 27, 2009 12:26pm | Edited at 12:37pm
  •  Arnold49
  • | Joined Apr 2008 | Status: Member | 294 Posts
no, I just removed all other EA and tried again , still the same, I will post the whole EA, the idea is , you open a trade then this manages the close by trailing a moving average

ps, just found some redundant code so I've removed it & re-posted
Attached File
File Type: mq4 8EMA trademanager EA.mq4   2 KB | 157 downloads
 
 
  • Post #8
  • Quote
  • Feb 27, 2009 10:06pm Feb 27, 2009 10:06pm
  •  lohikeitto
  • | Joined Nov 2008 | Status: Member | 41 Posts
Arnold49,

As I see, your EA will never manage trades on other symbol charts.

If it really happend without any other EAs,
the only possibility left is you used built-in trailing stop by MT4 terminal.

If negative, I have no idea about that, sorry.
 
 
  • Post #9
  • Quote
  • Mar 1, 2009 3:23pm Mar 1, 2009 3:23pm
  •  Arnold49
  • | Joined Apr 2008 | Status: Member | 294 Posts
ok, I don't understand it either, but thanks for looking.
 
 
  • Post #10
  • Quote
  • Mar 2, 2009 8:12am Mar 2, 2009 8:12am
  •  Arnold49
  • | Joined Apr 2008 | Status: Member | 294 Posts
this is weird, I've done some more testing

I have 3 charts open in demo, GBP/JPY, GBP/USD, EUR/USD

all have sell positions open

if I put the EA on GBP/JPY it adjusts all 3 charts

If I put it on GBP/USD it adjusts itself & EUR/USD

If I put it on EUR/USD It only adjusts itself

NO other EA or charts are open

Anybody?
 
 
  • Post #11
  • Quote
  • Last Post: Mar 2, 2009 8:51am Mar 2, 2009 8:51am
  •  Arnold49
  • | Joined Apr 2008 | Status: Member | 294 Posts
At last got to the bottom of it,

MT4 was corrupted, I deleted and re-installed MT4 , now it all works as it should!
 
 
  • Platform Tech
  • /
  • EA interfering with other charts
  • Reply to Thread
0 traders viewing now
Top of Page
Forex Factory Blog Updated: Alerting All Members
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2022