Community of Expertise - page 11

 
Yes, your face friendliness is top-notch! :)
 
is that serious, or are you just messing with me? ;)
 
I see the description but no attachments? Where can I download the library from?
 
need to register....
 
Forgot about that. It all worked out. Thanks. We'll see.
 
is that serious, or are you just messing with me? ;)

seriously, for newcomers to the market it's the right thing to do !, neat, informative, now it's up to the serious stuff.
 
Thank you. Always wondering what else to do...
suggestions for improvements are accepted out of turn =)
 
I suggest to discuss the following topic:<br/ translate="no"> how actual is trading on several symbols and/or timeframes within one Expert Advisor?

I am currently sitting and thinking - should I post symbol_lib and Expert Advisor template, intended for this purpose =)
and I think there is no such a need... If I trade on different accounts - I will still have to run several terminals, and if I trade on one - I will just open several windows. And there would be less confusion, it seems...

It will be interesting to hear opinions and arguments to them ;)


The topic is interesting, especially if there is a possibility to trade around the clock, (dedicated or ADSL and "server").
I'm not a programmer, but I have implemented trading on several pairs, the theme itself, the indicator was taken for pure experimentation, it is clear that the terms of trade everyone will choose for himself. The only hitch is that the EA should check if the orders are there and whether they are there for the tested symbol, sorry for the pun, I'm bored with it.


//----------------If there are orders on the vl----------------------- pair


int total=OrdersTotal();
int n=0;
Print ("Total orders==",total);
if (total>0)
{for (cnt=0;cnt>total;cnt++)
{OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
{if(OrderSymbol()==vl)
{n++; return(0);
}
}
}
}
//Print("NNN==",n," ",vl);
Print("STEP==",cnt," ", "Symbol", vl," ", "Orders==",n);
//---------------------------------------------

This is a piece of code that doesn't work, tell me, from the heights of a serious programmer's mind, what's the "bug"
 
There are no "serious programmers" here =) Mostly self-taught people here )
Yes, we should assign a MagicNumber to the order, and then check after the orderselect - if ( OrderMagicNumber() == _MagicNumber ) { then do something with the order.
You probably need to "mess around" yourself to understand how it works ;).

I will try to make your life easier - the _MagicNumber function (ATTENTION: if the required pair is not in the list, the magic will be generated non-original)
/////////////////////////////////////////////////////////////////////////////////
/**/ int _MagicNumber( int Expert_Id, string _Symbol, int _Period )
/////////////////////////////////////////////////////////////////////////////////
// Ф-ция генерирует MagicNumber, уникальный для связки Expert_Id - _Symbol - _Period.
// Expert_Id должен быть максимум четырёхзначный (т.е. <= 9999)
// Полученый MagicNumber будет 6-ти или 7-мизначный (в зависимости от Символа) и будет выглядеть так:
// SSPEEEE, где SS - это код символа (от 1 до 71), P - это код периода (от 1 до 8) и EEEE - Expert_Id (от 1 до 9999)
// 
// Таким образом, даже с одинаковым Expert_Id эксперты, работающие на разных Символах/ТФ будут использовать разные MagicNumber.
// Например, при Expert_Id = 1230, _Symbol = GBPUSD и _Period = PERIOD_H1,  MagicNumber будет 1141230
// А этот же эксперт, но на графике с периодом PERIOD_W1 будет иметь MagicNumber = 1181230
// Соответственно, если символ графика будет EURAUD, MagicNumber будет 141230
//
// т.е. Expert_Id есть смысл менять только если два эксперта работают на одном символе и одном ТФ
/////////////////////////////////////////////////////////////////////////////////
{
	int Period_Id = 9;
	switch ( _Period )
	{
		case PERIOD_MN1: Period_Id = 8; break;
		case PERIOD_W1:  Period_Id = 7; break;
		case PERIOD_D1:  Period_Id = 6; break;
		case PERIOD_H4:  Period_Id = 5; break;
		case PERIOD_H1:  Period_Id = 4; break;
		case PERIOD_M15: Period_Id = 3; break;
		case PERIOD_M5:  Period_Id = 2; break;
		case PERIOD_M1:  Period_Id = 1; break;
		default: Print( "trade_lib&info_lib - _MagicNumber( ", Expert_Id, ", ", _Symbol, ", ", _Period, " ) - Invalid Period! Function shall reurn 0!" ); return(0);
	}
	Period_Id *= 10000;
	
	int Symbol_Id = 99;
// forex
	if ( _Symbol == "AUDUSD" ) { Symbol_Id =  1; }
	if ( _Symbol == "CHFJPY" ) { Symbol_Id =  2; }
	if ( _Symbol == "EURAUD" ) { Symbol_Id =  3; }
	if ( _Symbol == "EURCAD" ) { Symbol_Id =  4; }
	if ( _Symbol == "EURCHF" ) { Symbol_Id =  5; }
	if ( _Symbol == "EURGBP" ) { Symbol_Id =  8; }
	if ( _Symbol == "EURJPY" ) { Symbol_Id =  7; }
	if ( _Symbol == "EURUSD" ) { Symbol_Id =  6; }
	if ( _Symbol == "GBPCHF" ) { Symbol_Id =  9; }
	if ( _Symbol == "GBPJPY" ) { Symbol_Id = 10; }
	if ( _Symbol == "GBPUSD" ) { Symbol_Id = 11; }
	if ( _Symbol == "USDCAD" ) { Symbol_Id = 12; }
	if ( _Symbol == "USDCHF" ) { Symbol_Id = 13; }
	if ( _Symbol == "USDJPY" ) { Symbol_Id = 14; }

// stock
	if ( _Symbol == "GOLD"   ) { Symbol_Id = 15; }

//cfd
	if ( _Symbol == "#AA"    ) { Symbol_Id = 16; }
	if ( _Symbol == "#AIG"   ) { Symbol_Id = 17; }
	if ( _Symbol == "#AXP"   ) { Symbol_Id = 18; }
	if ( _Symbol == "#BA"    ) { Symbol_Id = 19; }
	if ( _Symbol == "#C"     ) { Symbol_Id = 20; }
	if ( _Symbol == "#CAT"   ) { Symbol_Id = 21; }
	if ( _Symbol == "#DD"    ) { Symbol_Id = 22; }
	if ( _Symbol == "#DIA"   ) { Symbol_Id = 23; }
	if ( _Symbol == "#DIS"   ) { Symbol_Id = 24; }
	if ( _Symbol == "#EK"    ) { Symbol_Id = 25; }
	if ( _Symbol == "#GE"    ) { Symbol_Id = 26; }
	if ( _Symbol == "#GM"    ) { Symbol_Id = 27; }
	if ( _Symbol == "#HD"    ) { Symbol_Id = 28; }
	if ( _Symbol == "#HON"   ) { Symbol_Id = 29; }
	if ( _Symbol == "#HPQ"   ) { Symbol_Id = 30; }
	if ( _Symbol == "#IBM"   ) { Symbol_Id = 31; }
	if ( _Symbol == "#INTC"  ) { Symbol_Id = 32; }
	if ( _Symbol == "#IP"    ) { Symbol_Id = 33; }
	if ( _Symbol == "#JNJ"   ) { Symbol_Id = 34; }
	if ( _Symbol == "#JPM"   ) { Symbol_Id = 35; }
	if ( _Symbol == "#KO"    ) { Symbol_Id = 36; }
	if ( _Symbol == "#MCD"   ) { Symbol_Id = 37; }
	if ( _Symbol == "#MMM"   ) { Symbol_Id = 38; }
	if ( _Symbol == "#MO"    ) { Symbol_Id = 39; }
	if ( _Symbol == "#MRK"   ) { Symbol_Id = 40; }
	if ( _Symbol == "#MSFT"  ) { Symbol_Id = 41; }
	if ( _Symbol == "#PFE"   ) { Symbol_Id = 42; }
	if ( _Symbol == "#PG"    ) { Symbol_Id = 43; }
	if ( _Symbol == "#QQQ"   ) { Symbol_Id = 44; }
	if ( _Symbol == "#SBC"   ) { Symbol_Id = 45; }
	if ( _Symbol == "#SPY"   ) { Symbol_Id = 46; }
	if ( _Symbol == "#T"     ) { Symbol_Id = 47; }
	if ( _Symbol == "#UTX"   ) { Symbol_Id = 48; }
	if ( _Symbol == "#VZ"    ) { Symbol_Id = 49; }
	if ( _Symbol == "#WMT"   ) { Symbol_Id = 50; }
	if ( _Symbol == "#XOM"   ) { Symbol_Id = 51; }

//futures
	if ( _Symbol == "#CH5"   ) { Symbol_Id = 52; }
	if ( _Symbol == "#CK5"   ) { Symbol_Id = 53; }
	if ( _Symbol == "#CLG5"  ) { Symbol_Id = 54; }
	if ( _Symbol == "#CLH5"  ) { Symbol_Id = 55; }
	if ( _Symbol == "#CLJ5"  ) { Symbol_Id = 56; }
	if ( _Symbol == "#ENQH5" ) { Symbol_Id = 57; }
	if ( _Symbol == "#EPH5"  ) { Symbol_Id = 58; }
	if ( _Symbol == "#GOLDG5") { Symbol_Id = 59; }
	if ( _Symbol == "#GOLDJ5") { Symbol_Id = 60; }
	if ( _Symbol == "#NGH5"  ) { Symbol_Id = 61; }
	if ( _Symbol == "#NGJ5"  ) { Symbol_Id = 62; }
	if ( _Symbol == "#SH5"   ) { Symbol_Id = 63; }
	if ( _Symbol == "#SK5"   ) { Symbol_Id = 64; }
	if ( _Symbol == "#SLVH"  ) { Symbol_Id = 65; }
	if ( _Symbol == "#WH5"   ) { Symbol_Id = 66; }
	if ( _Symbol == "#WK5"   ) { Symbol_Id = 67; }

//index
	if ( _Symbol == "_DJI"   ) { Symbol_Id = 68; }
	if ( _Symbol == "_NQ100" ) { Symbol_Id = 69; }
	if ( _Symbol == "_NQCOMP") { Symbol_Id = 70; }
	if ( _Symbol == "_SP500" ) { Symbol_Id = 71; }

	if ( Symbol_Id == 99 ) { Print( "trade_lib&info_lib - _MagicNumber( ", Expert_Id, ", ", _Symbol, ", ", _Period, " ) - Invalid Symbol! Function shall reurn 0!" ); return(0); }
	Symbol_Id *= 100000;
	
	return(Expert_Id + Period_Id + Symbol_Id);
}
 
[quote]There are no "serious programmers" here =) Most of them are self-taught.)
[qoute]
Got it, thanks for MN, huge special thanks for the library, I'll try it out