Script to Close Orders based on selection of Symbol(s)
You need to add something like this in your loop:
for(int cnt=total;cnt>=0;cnt--) { if(OrderSelect(cnt,SELECT_BY_POS)) { if(OrderSymbol()!=symbol) continue; // symbol is what we want to close/delete // ...Regarding user input -> u can have them enter a comma separated list of pairs to close (via an extern of type string). Use a split function to break the string and verify the pairs are proper...
And replace
if (total > 0)
to
if (total >= 0)
I'm new to fxtrading. Started a little over 3 months and have got quite a good understanding of how it works. Also been looking at a few scripts and EAs.
Ok, now I have a good understanding about scripting since I've done C, C++ and Visual Basics, but about 6-7yrs back. I can understand what the code does if I look at the script but if I had to write it, would take ages.
Anyways, my problem is what the subject says exactly. Is it even possible to do it as a script. I downloaded a script from forexfactory, and modified it to work as a script to close only 1 symbol from any chart. But I trade in about 12 pairs, and I can't make an individual script for each pair and execute them seperately.
I was thinking if it was possible to have an array and store the symbols in it and the do a case() to get a selection which pairs to close.
Please guys if anyone could help me.. Really appreciate it.
I'm attaching two scripts;
1. This is the original one I downloaded...
2. The same script but modified to close one single pair....
Thanks & regards
Ecronic