so i revised that Crossed function with an MA_04_1H > MA_14_1H instead of the cross == 1 , and so on... and it typically fixed the problem... But I was wondering how I can filter out trades such as buy,close,buy,close,buy,close,sell,close,... It's eating away the balance cent by cent like -0.17,-0.18,-0.21,-0.15, and so on....
now I'm actually trying to implement something that if i buy a smaller lot and it profits, i close that order and open a new larger one until the crossing happens... but the problem above i can't seem to solve...
anybody knows how to filter out those small useless trades?
and this doesn't (when symbol is an array of strings and the 9th entry is "GBPJPY"):
price = MarketInfo(symbol[9],MODE_ASK);
??
From the info you presented, I'm 100% positive this should work, in fact, I just did a quick test to prove it. There must be something else that is wrong with your code.
If "GBPJPY" is the 9th element in an array its index in mql notation is 8 not 9 (in mql notation 1st element of an array has index 0), so in that case you should use this form :
price = MarketInfo(symbol[8],MODE_ASK);
Maybe that is the problem?
TomthebombNL: Can anyone tell me why this works:
price = MarketInfo("GBPJPY",MODE_ASK);
and this doesn't (when symbol is an array of strings and the 9th entry is "GBPJPY"):
another problem
so i revised that Crossed function with an MA_04_1H > MA_14_1H instead of the cross == 1 , and so on... and it typically fixed the problem... But I was wondering how I can filter out trades such as buy,close,buy,close,buy,close,sell,close,... It's eating away the balance cent by cent like -0.17,-0.18,-0.21,-0.15, and so on....
now I'm actually trying to implement something that if i buy a smaller lot and it profits, i close that order and open a new larger one until the crossing happens... but the problem above i can't seem to solve...
anybody knows how to filter out those small useless trades?
need afl for this code
Hi ,
i need the afl for this code
#property indicator_separate_window
#property indicator_buffers 8
#property indicator_color1 C'0x66,0xB3,0xFF'
#property indicator_color2 DodgerBlue
#property indicator_color3 C'0x00,0x67,0xCE'
#property indicator_color4 White
#property indicator_color5 C'0xFF,0x33,0x33'
#property indicator_color6 C'0xC4,0x00,0x00'
#property indicator_color7 C'0x8C,0x00,0x00'
#property indicator_color8 C'0x82,0x24,0x00'
extern int Periode = 30;
extern bool invert_strength = FALSE;
extern string CurrencyPair = "";
extern string NOTE0 = "enter currencypair in uppercase";
extern string NOTE1 = "like EURUSD";
extern string NOTE2 = "leave empty for current symbol";
extern string NOTE3 = "if you have a mini account";
extern string NOTE4 = "add a \"m\" e.g EURUSDm ";
double g_ibuf_132[];
double g_ibuf_136[];
double g_ibuf_140[];
double g_ibuf_144[];
double g_ibuf_148[];
double g_ibuf_152[];
double g_ibuf_156[];
double g_ibuf_160[];
double gda_unused_164[];
int init() {
SetIndexBuffer(0, g_ibuf_132);
SetIndexBuffer(1, g_ibuf_136);
SetIndexBuffer(2, g_ibuf_140);
SetIndexBuffer(3, g_ibuf_144);
SetIndexBuffer(4, g_ibuf_148);
SetIndexBuffer(5, g_ibuf_152);
SetIndexBuffer(6, g_ibuf_156);
SetIndexBuffer(7, g_ibuf_160);
SetIndexStyle(0, DRAW_HISTOGRAM, EMPTY, 5, C'0x66,0xB3,0xFF');
SetIndexStyle(1, DRAW_HISTOGRAM, EMPTY, 5, DodgerBlue);
SetIndexStyle(2, DRAW_HISTOGRAM, EMPTY, 5, C'0x00,0x67,0xCE');
SetIndexStyle(3, DRAW_HISTOGRAM, EMPTY, 5, White);
SetIndexStyle(4, DRAW_HISTOGRAM, EMPTY, 5, C'0xFF,0x33,0x33');
SetIndexStyle(5, DRAW_HISTOGRAM, EMPTY, 5, C'0xC4,0x00,0x00');
SetIndexStyle(6, DRAW_HISTOGRAM, EMPTY, 5, C'0x8C,0x00,0x00');
SetIndexStyle(7, DRAW_HISTOGRAM, EMPTY, 5, C'0x82,0x24,0x00');
for (int li_0 = 0; li_0 < 8; li_0++) SetIndexLabel(li_0, NULL);
if (CurrencyPair == "") CurrencyPair = Symbol();
if (iClose(CurrencyPair, 0, 0) == 0.0) CurrencyPair = Symbol();
IndicatorShortName(CurrencyPair + "(" + Periode + ")");
return (1);
}
int deinit() {
return (0);
}
int start() {
double ld_8;
int li_0 = IndicatorCounted();
if (li_0 < 0) return (-1);
if (li_0 > 0) li_0--;
for (int li_4 = Bars - li_0; li_4 >= 0; li_4--) {
ld_8 = iRSI(CurrencyPair, 0, Periode, PRICE_CLOSE, li_4);
if (invert_strength == TRUE) ld_8 -= 2.0 * (ld_8 - 50.0);
if (ld_8 <= 45.0) {
if (ld_8 42.0) drawblock(0, 0, 0, 0, 5, 0, 0, 0, li_4);
else {
if (ld_8 38.0) drawblock(0, 0, 0, 0, 0, 5, 0, 0, li_4);
else {
if (ld_8 35.0) drawblock(0, 0, 0, 0, 0, 0, 5, 0, li_4);
else drawblock(0, 0, 0, 0, 0, 0, 0, 5, li_4);
}
}
} else {
if (ld_8 >= 55.0) {
if (ld_8 > 55.0 && ld_8 < 57.0) drawblock(5, 0, 0, 0, 0, 0, 0, 0, li_4);
else {
if (ld_8 >= 58.0 && ld_8 < 60.0) drawblock(0, 5, 0, 0, 0, 0, 0, 0, li_4);
else drawblock(0, 0, 5, 0, 0, 0, 0, 0, li_4);
}
} else drawblock(0, 0, 0, 5, 0, 0, 0, 0, li_4);
}
}
return (0);
}
void drawblock(int ai_0, int ai_4, int ai_8, int ai_12, int ai_16, int ai_20, int ai_24, int ai_28, int ai_32) {
g_ibuf_132[ai_32] = ai_0;
g_ibuf_136[ai_32] = ai_4;
g_ibuf_140[ai_32] = ai_8;
g_ibuf_144[ai_32] = ai_12;
g_ibuf_148[ai_32] = ai_16;
g_ibuf_152[ai_32] = ai_20;
g_ibuf_156[ai_32] = ai_24;
g_ibuf_160[ai_32] = ai_28;
}
or please explain me the logic behind this
thanks
kr
how NOT to buy,close,buy,close or sell,close,sell,close...
please... i really have to know how to avoid those unprofitable trades...
Urgent help. Convert Indicator to EA (Auto Trader)
I am a programmer but newbie in mql4 programming.
I am trying to create a EA (auto trader) regarding an indicator.
I attached the indicator. This indicator gives good trend signals.
Now wanna make a auto trader regarding the trend signals.
Algorithm:
==================================================
If DOWN SIGNAL then open SELL order and close previous BUY order
If UP SIGNAL then open BUY order and close previous SELL order
continue ....
==================================================
I wanna just manual trading to auto trading regarding this indicator.
Can anybody help me?? I tried but not get the result
I think it would be a good auto trader. Please help me.
simple question, can't find the answer...
Can anyone tell me why this works:
price = MarketInfo("GBPJPY",MODE_ASK);
and this doesn't (when symbol is an array of strings and the 9th entry is "GBPJPY"):
price = MarketInfo(symbol[9],MODE_ASK);
??
Can anyone tell me why this works:
price = MarketInfo("GBPJPY",MODE_ASK);
and this doesn't (when symbol is an array of strings and the 9th entry is "GBPJPY"):
price = MarketInfo(symbol[9],MODE_ASK);
??From the info you presented, I'm 100% positive this should work, in fact, I just did a quick test to prove it. There must be something else that is wrong with your code.
jdun,
The easiest way to reverse the code (sell to buy & buy to sell) is changing:
if(signal0 > signal1) GlobalVariableSet("TM0",0);[/CODE]
To:
[CODE]if(signal0 > signal1 ) GlobalVariableSet("TM0",1);
if(signal0 < signal1) GlobalVariableSet("TM0",0);nice! Thank you for this info.
I think most likely your did not define your array as string.
If "GBPJPY" is the 9th element in an array its index in mql notation is 8 not 9 (in mql notation 1st element of an array has index 0), so in that case you should use this form :
Maybe that is the problem?
Can anyone tell me why this works:
price = MarketInfo("GBPJPY",MODE_ASK);
and this doesn't (when symbol is an array of strings and the 9th entry is "GBPJPY"):
price = MarketInfo(symbol[9],MODE_ASK);
??I got the number right i maybe messed up with explaining it, it is the 10th entry and to get it i used symbol[9]. Strangely this works:
high = iHigh(symbol[9], ...)
that gives me the high. My declaration is:
string symbol[] or should it be like string[] symbol[] ?
if i try to print it with Alert(symbol[9]) it gives also an empty space, quite a strange problem... but anyway thanks for your suggestions.
This is my code, I use alpari 5 digit broker (the alert gives me zero for some reason):
double high,low,price,distance, plaats;
int i,j,ticket, waarde;
string symbol[];
string zoekplaatssymbol;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
double usd=0.0;
double chf=0.0;
double eur=0.0;
double gbp=0.0;
double aud=0.0;
double cad=0.0;
double jpy=0.0;
double nzd=0.0;
symbol[21] = {"USDCHF" , "EURUSD" , "GBPUSD" , "USDJPY" , "AUDUSD" , "USDCAD" , "EURGBP" , "EURCHF" , "EURJPY" , "GBPJPY" , "GBPCHF" , "EURAUD" , "NZDUSD" , "CHFJPY" ,
"EURCAD" , "AUDCAD" , "AUDJPY" , "CADJPY" , "EURNZD" , "AUDNZD" , "NZDJPY"};
int total=OrdersTotal();
//zoekplaatssymbol = symbol[9];
// waarde = zoekplaats(zoekplaatssymbol);
price = MarketInfo(symbol[9],MODE_ASK);
Alert(price);
}