And I am back with another coding question.
I managed to write an EA which takes trades based on the Advanced Currency Meter.
The attached code is just a small script I wrote to try and exclude certain symbols when the EA runs. (The code will obviously be incorporated in the EA, I just wrote a script to test)
extern string Symbols_To_Exclude = "GBPUSD,AUDUSD,USDJPY,GBPCHF";
enum currencies {Top6=5,TopRow=13,All=27};
input currencies Symbols_To_Trade = Top6;
string ccy;
string dir;
void OnStart()
{
for (int c=0;c<=Symbols_To_Trade;c++)
{
ccy=ObjectGetString(0,"currency"+IntegerToString(c,1),OBJPROP_TEXT);//Symbol
int d = (c+40);
dir=ObjectGetString(0,"currency"+IntegerToString(d,1),OBJPROP_TEXT);//Direction
for (int i=0; i<=70; i+=7)
{
string exclude =StringSubstr(Symbols_To_Exclude,i,StringLen(ccy));
if (ccy== exclude)break;
MessageBox ("Not excluded " +ccy);
}
}
}
//+------------------------------------------------------------------+
As you can see I have a drop down menu for which symbol groups to trade, now I want to exclude certain symbols too.
It looks as if it works, but I excluded GBPUSD, AUDUSD and USDJPY as a test, when the message box pops up, it doesn't show GBPUSD, but it still shows USDJPY once, and AUDUSD twice, I understand it is because the loop runs, but if it is in an EA, it will actually take a trade on the excluded pairs, (or am I wrong, because in my mind, the OrderSend func will be where the MessageBox func is now, (after all the other expressions it had to pass) so the OrderSend function will be executed?)
Thanks again.