Edit Your Comment
Discussion of the Forex Contest OctaFX Forex Contest
Jun 09, 2014 at 10:09
Miembro desde Jun 05, 2014
posts 6
tsedawa posted:
does anybody know what mt4 code i need to put in my EA so that it works for symbols with suffix like EURUSD.ecn?
please help. thx.
Use 'Symbol()' in your code -> it will then use the Symbol of the current chart it is attached to.
Jun 09, 2014 at 13:27
Miembro desde Nov 15, 2012
posts 3
Hi Christian, this will work only if the EA is one pair dedicated. What about if his EA is by default attached to one chart but is looking for setups on all or on some pairs?
Use 'Symbol()' in your code -> it will then use the Symbol of the current chart it is attached to.
Any way, if in your code you see an explicit list of pairs, you should change their names according to OctaFX symbols name, some times it may work (not always).
Best wishes, Nicolae
Jun 09, 2014 at 15:18
Miembro desde Jul 20, 2011
posts 5
thx for replies
i have Symbol() in my code but still its not working. so when i put these codes its working for the particular pair. what i want is instead of 'EURUSD' i need a general formula to cover other pairs. does any body know how?
extern string SymbolSuffix='.ecn'
int init()
if(StringLen(Symbol())>6) CurrentSymbol = ('EURUSD'+SymbolSuffix);
else CurrentSymbol = Symbol();
i have Symbol() in my code but still its not working. so when i put these codes its working for the particular pair. what i want is instead of 'EURUSD' i need a general formula to cover other pairs. does any body know how?
extern string SymbolSuffix='.ecn'
int init()
if(StringLen(Symbol())>6) CurrentSymbol = ('EURUSD'+SymbolSuffix);
else CurrentSymbol = Symbol();
forex_trader_111028
Miembro desde Feb 07, 2013
posts 8
Jun 10, 2014 at 07:50
Miembro desde Feb 07, 2013
posts 8
What I have always done is code it like this -
I first make an-
extern string Symbol_1 = 'EURUSD.ecn'
Repeat making extern strings for as many symbols as your EA uses. Then go down into your code and change your symbol() to Symbol_1, and so on.
This way you can type in the broker symbol and suffix into the external variables once it's on the chart.
I first make an-
extern string Symbol_1 = 'EURUSD.ecn'
Repeat making extern strings for as many symbols as your EA uses. Then go down into your code and change your symbol() to Symbol_1, and so on.
This way you can type in the broker symbol and suffix into the external variables once it's on the chart.
Jun 10, 2014 at 21:21
Miembro desde Nov 15, 2012
posts 3
I don't know if it is allowed to post code here .... but may be useful for contest participants using experts.
I've made a script, for my personal use, that dully identifies all pairs in the symbols provided by the broker.
For example, if a broker provides a symbol named 'EuR loves uSD' the script will understand that is about EURUSD and will act properly. If the name will be 'uSd is better than Eur' the script will identify the pair 'USDEUR' and will take it as it is (this is important for users of EAs that include a strong/weak analysis filter module).
This is the module:
int Pairs_Data()
{
/* +-----------------------------------------------------------+
| Outputs: |
| Pairs[i] Pair 'i' symbol |
| Currencies[i] Currency 'i' symbol |
| Multiplier[i] Pair 'i' Multiplier Price - Pips |
| Pips = Price Difference x Multiplier |
| Currency_In_Pair[i][k] Currencies in pair 'i' |
| where k =1 or 2 |
| Currency_In_Pair[i][1]=j (code of the first currency) |
| Currency 'j' is the FIRST currency in pair 'i' |
| Currency_In_Pair[x][2]=k (code of the second currency)|
| Declarations |
| The following arrays should be declared in the main area:|
| string Currencies[9]; |
| string Pairs[29]; |
| int Multiplier[29]; |
| int Currency_In_Pair[29][3]; |
+-----------------------------------------------------------+ */
int P_i, P_j, P_k, Currency_1_Position, Currency_2_Position, C1_i, C2_i, C_Search, P_Pair_Code;
string Symbol_List[];
// +-----------------------------------------------------+
// | Currencies |
// +-----------------------------------------------------+
Currencies[1]='USD'; Currencies[2]='EUR'; Currencies[3]='GBP'; Currencies[4]='CHF';
Currencies[5]='JPY'; Currencies[6]='AUD'; Currencies[7]='NZD'; Currencies[8]='CAD';
// +-----------------------------------------------------+
// | Pairs |
// +-----------------------------------------------------+
ArrayResize(Symbol_List,SymbolsTotal(false)+2); // Resize Symbol_List with the actual number of Symbols provided by broker
for (P_k=0;P_k<=SymbolsTotal(false);P_k++) Symbol_List[P_k]=SymbolName(P_k,false); // Loads array Symbol_List with all Symbols provided by broker
for (P_k=0;P_k<=SymbolsTotal(false);P_k++) StringToUpper(Symbol_List[P_k]); // Converts all letters in the Symbol_List in upper case
P_Pair_Code=0;
for (C1_i=1;C1_i<=7;C1_i++) // Currency 1 cycle
{
for(C2_i=C1_i+1;C2_i<=8;C2_i++) // Currency 2 cycle
{
for (P_k=0;P_k<=SymbolsTotal(false);P_k++) // Symbols cycle
{
Currency_1_Position=-1; Currency_2_Position=-1; // Initialization of currency position in Symbol
for (C_Search = 0; C_Search<= StringLen(Symbol_List[P_k])-3;C_Search ++) // Search in the Symbol name if some currency is found
{
if(Currencies[C1_i]==StringSubstr(Symbol_List[P_k],C_Search,3)) Currency_1_Position = C_Search; // Currency C1_i found somewhere in the Symbol name (in position C_Search)
if(Currencies[C2_i]==StringSubstr(Symbol_List[P_k],C_Search,3)) Currency_2_Position = C_Search; // Currency C2_i found somewhere in the Symbol name (in position C_Search)
}
if(MathAbs(Currency_1_Position - Currency_2_Position)>=3 && // No currency name overlap accidentally
Currency_1_Position>=0 && // Currency_1 found in the Symbol
Currency_2_Position>=0) // Currency_2 found in the Symbol
// We have a pair.
{
P_Pair_Code++; // New pair, new code
Pairs[P_Pair_Code] = SymbolName(P_k,false); // Loads in the pairs' array the symbol name from SymbolName(P_k,false)
if (Currency_1_Position<Currency_2_Position)
{
Currency_In_Pair[P_Pair_Code][1]=C1_i; // Currency_1 is the first currency in the pair
Currency_In_Pair[P_Pair_Code][2]=C2_i; // Currency_2 is the second currency in the pair
}
if (Currency_2_Position<Currency_1_Position)
{
Currency_In_Pair[P_Pair_Code][1]=C2_i; // Currency_2 is the first currency in the pair
Currency_In_Pair[P_Pair_Code][2]=C1_i; // Currency_1 is the second currency in the pair
}
}
}
}
}
for (P_i=1;P_i<=P_Pair_Code;P_i++) // pairs' cycle to compute Multiplier pips = price x Multiplier
{
Multiplier[P_i]=1;
for (P_j=2;P_j<=MarketInfo(Pairs[P_i],MODE_DIGITS);P_j++) Multiplier[P_i]=Multiplier[P_i]*10;
}
return(P_Pair_Code);
}
---- END Pairs Module ----
Important:
The following declarations in the main area:
string Currencies[9], Pairs[29];
int Multiplier[29], Currency_In_Pair[29][3];
I've tested this module on OctaTrader, with the following OnInit() function:
int Total_Pairs, Current_Pair;
int OnInit()
{
//---
Total_Pairs=Pairs_Data();
for (i=1;i<=Total_Pairs;i++) Alert (i,' ',Pairs[i],' ',Currencies[Currency_In_Pair[i][1]],' ',Currencies[Currency_In_Pair[i][2]]);
for(i=1;i<=Total_Pairs;i++) if (Pairs[i]==Symbol()) Current_Pair = i;
Alert (Current_Pair,' This chart is for ',Pairs[Current_Pair]);
Alert (' Currencies in the current pair are: First currency: ',Currencies[Currency_In_Pair[Current_Pair][1]],
' || Second currency: ',Currencies[Currency_In_Pair[Current_Pair][2]]);
//---
return(INIT_SUCCEEDED);
}
This way, user can load the code pair in Current_Pair and replace any Symbol() in code with Pairs[Current_Pair]
This allows also to use only one EA, loaded on one chart, for all pairs, using an external cycle Pairs[x]
Hope it helps :)
I've made a script, for my personal use, that dully identifies all pairs in the symbols provided by the broker.
For example, if a broker provides a symbol named 'EuR loves uSD' the script will understand that is about EURUSD and will act properly. If the name will be 'uSd is better than Eur' the script will identify the pair 'USDEUR' and will take it as it is (this is important for users of EAs that include a strong/weak analysis filter module).
This is the module:
int Pairs_Data()
{
/* +-----------------------------------------------------------+
| Outputs: |
| Pairs[i] Pair 'i' symbol |
| Currencies[i] Currency 'i' symbol |
| Multiplier[i] Pair 'i' Multiplier Price - Pips |
| Pips = Price Difference x Multiplier |
| Currency_In_Pair[i][k] Currencies in pair 'i' |
| where k =1 or 2 |
| Currency_In_Pair[i][1]=j (code of the first currency) |
| Currency 'j' is the FIRST currency in pair 'i' |
| Currency_In_Pair[x][2]=k (code of the second currency)|
| Declarations |
| The following arrays should be declared in the main area:|
| string Currencies[9]; |
| string Pairs[29]; |
| int Multiplier[29]; |
| int Currency_In_Pair[29][3]; |
+-----------------------------------------------------------+ */
int P_i, P_j, P_k, Currency_1_Position, Currency_2_Position, C1_i, C2_i, C_Search, P_Pair_Code;
string Symbol_List[];
// +-----------------------------------------------------+
// | Currencies |
// +-----------------------------------------------------+
Currencies[1]='USD'; Currencies[2]='EUR'; Currencies[3]='GBP'; Currencies[4]='CHF';
Currencies[5]='JPY'; Currencies[6]='AUD'; Currencies[7]='NZD'; Currencies[8]='CAD';
// +-----------------------------------------------------+
// | Pairs |
// +-----------------------------------------------------+
ArrayResize(Symbol_List,SymbolsTotal(false)+2); // Resize Symbol_List with the actual number of Symbols provided by broker
for (P_k=0;P_k<=SymbolsTotal(false);P_k++) Symbol_List[P_k]=SymbolName(P_k,false); // Loads array Symbol_List with all Symbols provided by broker
for (P_k=0;P_k<=SymbolsTotal(false);P_k++) StringToUpper(Symbol_List[P_k]); // Converts all letters in the Symbol_List in upper case
P_Pair_Code=0;
for (C1_i=1;C1_i<=7;C1_i++) // Currency 1 cycle
{
for(C2_i=C1_i+1;C2_i<=8;C2_i++) // Currency 2 cycle
{
for (P_k=0;P_k<=SymbolsTotal(false);P_k++) // Symbols cycle
{
Currency_1_Position=-1; Currency_2_Position=-1; // Initialization of currency position in Symbol
for (C_Search = 0; C_Search<= StringLen(Symbol_List[P_k])-3;C_Search ++) // Search in the Symbol name if some currency is found
{
if(Currencies[C1_i]==StringSubstr(Symbol_List[P_k],C_Search,3)) Currency_1_Position = C_Search; // Currency C1_i found somewhere in the Symbol name (in position C_Search)
if(Currencies[C2_i]==StringSubstr(Symbol_List[P_k],C_Search,3)) Currency_2_Position = C_Search; // Currency C2_i found somewhere in the Symbol name (in position C_Search)
}
if(MathAbs(Currency_1_Position - Currency_2_Position)>=3 && // No currency name overlap accidentally
Currency_1_Position>=0 && // Currency_1 found in the Symbol
Currency_2_Position>=0) // Currency_2 found in the Symbol
// We have a pair.
{
P_Pair_Code++; // New pair, new code
Pairs[P_Pair_Code] = SymbolName(P_k,false); // Loads in the pairs' array the symbol name from SymbolName(P_k,false)
if (Currency_1_Position<Currency_2_Position)
{
Currency_In_Pair[P_Pair_Code][1]=C1_i; // Currency_1 is the first currency in the pair
Currency_In_Pair[P_Pair_Code][2]=C2_i; // Currency_2 is the second currency in the pair
}
if (Currency_2_Position<Currency_1_Position)
{
Currency_In_Pair[P_Pair_Code][1]=C2_i; // Currency_2 is the first currency in the pair
Currency_In_Pair[P_Pair_Code][2]=C1_i; // Currency_1 is the second currency in the pair
}
}
}
}
}
for (P_i=1;P_i<=P_Pair_Code;P_i++) // pairs' cycle to compute Multiplier pips = price x Multiplier
{
Multiplier[P_i]=1;
for (P_j=2;P_j<=MarketInfo(Pairs[P_i],MODE_DIGITS);P_j++) Multiplier[P_i]=Multiplier[P_i]*10;
}
return(P_Pair_Code);
}
---- END Pairs Module ----
Important:
The following declarations in the main area:
string Currencies[9], Pairs[29];
int Multiplier[29], Currency_In_Pair[29][3];
I've tested this module on OctaTrader, with the following OnInit() function:
int Total_Pairs, Current_Pair;
int OnInit()
{
//---
Total_Pairs=Pairs_Data();
for (i=1;i<=Total_Pairs;i++) Alert (i,' ',Pairs[i],' ',Currencies[Currency_In_Pair[i][1]],' ',Currencies[Currency_In_Pair[i][2]]);
for(i=1;i<=Total_Pairs;i++) if (Pairs[i]==Symbol()) Current_Pair = i;
Alert (Current_Pair,' This chart is for ',Pairs[Current_Pair]);
Alert (' Currencies in the current pair are: First currency: ',Currencies[Currency_In_Pair[Current_Pair][1]],
' || Second currency: ',Currencies[Currency_In_Pair[Current_Pair][2]]);
//---
return(INIT_SUCCEEDED);
}
This way, user can load the code pair in Current_Pair and replace any Symbol() in code with Pairs[Current_Pair]
This allows also to use only one EA, loaded on one chart, for all pairs, using an external cycle Pairs[x]
Hope it helps :)
Jun 11, 2014 at 09:56
Miembro desde Jun 04, 2014
posts 18
protrader624 posted:hi
One of the rules states,NO IP MATCH,what does this mean?
found this under octa fx promotion rules (8 Dollars promotion account)
ANY IP match between 2 accounts regardless of trading style, name, email, country, etc. will be considered as multiple bonus
accounts. Such accounts will be blocked, and all withdrawals will be rejected
Jun 11, 2014 at 10:54
Miembro desde Jun 04, 2014
posts 18
protrader624 posted:you know the laws in America.
Are trader's from the USA allowed ?
for demo u can trade what u want but when it comes to real account u has to reduce the leverage i think.dont know if octa is
allowed to offer real accounts in America.when u win u have to be sure its all legal otherwise your prize will go to the next one.
Jun 12, 2014 at 21:23
Miembro desde Nov 02, 2009
posts 67
Kulae posted:Hi Christian, this will work only if the EA is one pair dedicated. What about if his EA is by default attached to one chart but is looking for setups on all or on some pairs?
Use 'Symbol()' in your code -> it will then use the Symbol of the current chart it is attached to.
Any way, if in your code you see an explicit list of pairs, you should change their names according to OctaFX symbols name, some times it may work (not always).
Best wishes, Nicolae
// pass symbol to this function to 'fix' the symbol name
string fixSymbol(string sym) {
return StringSubstring(sym, 0, 6) + StringSubstring(Symbol(), 6);
}
Jun 12, 2014 at 22:49
Miembro desde Oct 23, 2012
posts 349
mamista posted:
Guys please HELP
I need the renko chart for ECN ACCOUNT
Please help me
here is the one i use...
https://www.myfxbook.com/files/sirius1fx/RenkoLiveChart_EA_Yn.mq4
if you follow the flock like sheep you always end up stepping in shit!
Jun 14, 2014 at 13:45
Miembro desde Feb 07, 2014
posts 5
I WILL BE FOOLED !! PROBLEMS EVERYWHERE
PLEASE HELP ME , CHECK THE PICTURE
PLEASE HELP ME , CHECK THE PICTURE
Miembro desde Sep 12, 2013
posts 1
*El uso comercial y el spam no serán tolerados y pueden resultar en el cierre de la cuenta.
Consejo: Al publicar una imagen o una URL de YouTube, ésta se integrará automáticamente en su mensaje!
Consejo: Escriba el signo @ para completar automáticamente un nombre de usuario que participa en esta discusión.