You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I think the OP needs to clarify his/her question. As WHRoeder and others are fond of saying: there are no mind readers here.
JJF, please provide the forum with more information regarding your question. For example, why is the external information (i.e., ticket numbers) needed and from where the information come from? Another example might be why you want the information in a certain way (i.e., string-based variables versus integer-based variables). These are just examples...please fill free to provide as much (or as little) additional information that you believe is necessary, but remember, the forums ability to help is proportional to the amount and specificity of the information you provide.
I think this is the key phrase . . .
"let say I place the constructed var name into to a "normal" var (string) called 'trade_x'"
Well, the actual use is to exclude trades when I am looking to bail_out from a mix of profitable & non_profitable trades without 'harming' other 'long range' trades that I would like to keep.
So this is how it looks now:
Thanks for all the answers,
James
Greetings,
Well, the actual use is to exclude trades when I am looking to bail_out from a mix of profitable & non_profitable trades without 'harming' other 'long range' trades that I would like to keep.
So this is how it looks now:
Thanks for all the answers,
James
Now I really get it. Use MT4 GlobalVariable() - GV - like I've told you before. Write this script.
Open MT4 > open GV window by press F3 > click "Add" button to create new GV > name it "Trade1" and set it's value > then do it again for "Trade2, Trade3, ... Trade16, Trade17, ... Trade100, Trade 101 ... .
Then run the script.
Nasty thing is, you have to delete, unused GV manually.
I never use F3 to fill the value of the GVs, I use script instead, so I can load the saved .set parameters. You resourceful guy, you figure that out.
:(
Greetings,
Well, the actual use is to exclude trades when I am looking to bail_out from a mix of profitable & non_profitable trades without 'harming' other 'long range' trades that I would like to keep.
So this is how it looks now:
Thanks for all the answers,
James
Well the thing is that you are apparently having to type in the ticket numbers of the trades you wish to exclude. But that is an error prone unpleasant task. Some possibilities:
Give the "long range" trades magic numbers so they can be protected, or give the newer short term trades magic numbers so they can be selected. The idea is to get the computer to do the work.
Look at the start time of the trade and only include/exclude trades which are from long ago.
Use different lot sizes on "long range" trades compared to others eg 0.10 lots and 0.11 lots.
In terms of the coding
OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES);
When selecting by ticket the MODE_TRADES parameter is not actually doing anything and is better off left off so you realize that you can be selecting from the history pool as well. And make sure you check, and report the OrderSelect if it fails.
Greetings,
Well, the actual use is to exclude trades when I am looking to bail_out from a mix of profitable & non_profitable trades without 'harming' other 'long range' trades that I would like to keep.
So this is how it looks now:
Thanks for all the answers,
James
You should do
#property show_inputs
to make sure the script pops up the inputs box before it runs
My system picks the 'long range' automatically by choosing the lowest buy and the highest sell (separately for each pair or commodity).
Choosing by time is not good enough. A better 'long range' trade can be acquired later then an existing one.
Also, that is the reason why marking them by lot size can be misleading.
Beside, if I have to 'sacrifice' some of my 'less valuable' trades to ditch a mix of loosing and profiting trades (of different pairs, time and lot size) without a loss, I think I have to pick them manually.
You mentioned 'magic numbers' as a way to mark them automatically.
I saw that 'magic number' title before, but I couldn't figure out what they are good for.
James
I saw that 'magic number' title before, but I couldn't figure out what they are good for.
The documentation is non-existent on that point. Basically a magic number is just an integer (whole number) that you can define for the purpose of identifying a particular trade type or more specifically an owner.
#define MAGICNUMBER 38942403
Every EA would use its own unique magic number and then the EA knows which trades "belong to it". The EA "thinks to itself", if the trade has a magic number of 38942403 then it is one that I placed and I have to decide what to do with it.
Read this ...
https://www.mql5.com/en/articles/1359
(just sections 1 and 2 will be enough)