Is it possible to increment a MagicNumber using a script

 

I have an EA that opens orders based on trendlines I can drag around the chart.

I'd like to quickly reset this EA by applying it to a new chart leaving the lines in place.

I've writen a simple script to delete certain components, leaving the lines.

However, the dupliate MagicNumber (extern variable)  prevents me from taking quick trades.

My question  - Is it possible to change the MagicNumber used by the EA using the script (ie. without F7 ...)?

Ideally, MagicNumber 40000 would become 40010, then 40020, on subsquent trades

 
Use global variables (see the MQL documentation). When doing a manual trade through your script, set a global variable to something. Your EA then checks this value to determine what action to take (either use your EA's magic number or some other value).
 
Steigo:

My question  - Is it possible to change the MagicNumber used by the EA using the script (ie. without F7 ...)?

Ideally, MagicNumber 40000 would become 40010, then 40020, on subsquent trades

Yes its possible. Its just a number, you can add/subtract/multiply it.

But I would prefer using comments instead to identify individual trades - just my way.

 
  1. Comments can be completely changed by the broker.
  2. You can change the MN on a chart change (TF, pair, etc) but it should forget all other trades. Why would you want that? And if there are no open trades, they why do you need to change it?
Reason: