hello 
sorry for my terrible english
i try to make an ea but i have problems with icustom
i am using supertrend
http://codebase.mql4.com/3959
variables Nbr_Periods and Multiplier
and nonlagdot
http://codebase.mql4.com/3055
variables Price, Length, Displace, Filter, Color, ColorBarBack, Deviation
i have written some code but now i have trouble
here is my code
my plan
if the supertrend indicator change to uptrend (green) and the dots are blue (uptrend) > buy
if the supertrend indicator change to downtrend (red) and the dots are red (downtrend) > sell
thank you very much
sorry for my terrible english
i try to make an ea but i have problems with icustom
i am using supertrend
http://codebase.mql4.com/3959
variables Nbr_Periods and Multiplier
and nonlagdot
http://codebase.mql4.com/3055
variables Price, Length, Displace, Filter, Color, ColorBarBack, Deviation
i have written some code but now i have trouble
here is my code
Inserted Code
#include <stdlib.mqh>
extern int TrailingStop11 = 10;
extern int NewTakeProfit11 = 30;
extern int TrailingGap11 = 3;
extern double BuyLots9 = 0.3;
extern int BuyStoploss9 = 50;
extern int BuyTakeprofit9 = 100;
double gd_104 = 1.0;
bool gi_112 = FALSE;
int init() {
Comment("");
return (0);
}
int start() {
if (Bars < 10) {
Comment("Not enough bars");
return (0);
}
if (gi_112 == TRUE) {
Comment("EA Terminated.");
return (0);
}
OnEveryTick2();
return (0);
}
void OnEveryTick2() {
TrailingStop11();
TechnicalAnalysis2x5();
TechnicalAnalysis2x1();
}
void TrailingStop11() {
for (int l_pos_0 = OrdersTotal() - 1; l_pos_0 >= 0; l_pos_0--) {
if (OrderSelect(l_pos_0, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol() == Symbol() && OrderMagicNumber() == 1) {
if (OrderType() == OP_BUY && Ask - OrderOpenPrice() > TrailingStop11 * gd_104 * Point)
if (OrderStopLoss() < Ask - (TrailingStop11 + TrailingGap11) * gd_104 * Point) OrderModify(OrderTicket(), OrderOpenPrice(), Ask - TrailingStop11 * gd_104 * Point, Ask + (NewTakeProfit11 + TrailingStop11) * gd_104 * Point, OrderExpiration(), White);
if (OrderType() == OP_SELL && OrderOpenPrice() - Bid > TrailingStop11 * gd_104 * Point)
if (OrderStopLoss() > Bid + (TrailingStop11 + TrailingGap11) * gd_104 * Point) OrderModify(OrderTicket(), OrderOpenPrice(), Bid + TrailingStop11 * gd_104 * Point, Bid - (NewTakeProfit11 + TrailingStop11) * gd_104 * Point, OrderExpiration(), White);
}
} else Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
}
void TechnicalAnalysis2x5() {
if (iCustom(NULL, 0, "SuperTrend", 1, 1, 1, 0) > iCustom(NULL, 0, "SuperTrend", 1, 1, 1, 0) && iCustom(NULL, 0, "nonlagdot", 1, 1, 1, 1, 1, 1, 1, 1, 0) > iCustom(NULL, 0, "nonlagdot", 1, 1, 1, 1, 1, 1, 1, 1, 0)) IfOrderDoesNotExist6();
}
void IfOrderDoesNotExist6() {
bool li_0 = FALSE;
for (int l_pos_4 = OrdersTotal() - 1; l_pos_4 >= 0; l_pos_4--) {
if (OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES)) {
if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == 1) li_0 = TRUE;
} else Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (li_0 == FALSE) {
}
}
void TechnicalAnalysis2x1() {
if (iCustom(NULL, 0, "SuperTrend", 1, 1, 1, 0) > iCustom(NULL, 0, "SuperTrend", 1, 1, 1, 0) && iCustom(NULL, 0, "nonlagdot", 1, 1, 1, 1, 1, 1, 1, 1, 0) > iCustom(NULL, 0, "nonlagdot", 1, 1, 1, 1, 1, 1, 1, 1, 0)) IfOrderDoesNotExist3();
}
void IfOrderDoesNotExist3() {
bool li_0 = FALSE;
for (int l_pos_4 = OrdersTotal() - 1; l_pos_4 >= 0; l_pos_4--) {
if (OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES)) {
if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == 1) li_0 = TRUE;
} else Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (li_0 == FALSE) IfOrderDoesNotExist7();
}
void IfOrderDoesNotExist7() {
bool li_0 = FALSE;
for (int l_pos_4 = OrdersTotal() - 1; l_pos_4 >= 0; l_pos_4--) {
if (OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES)) {
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 1) li_0 = TRUE;
} else Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (li_0 == FALSE) BuyOrder9();
}
void BuyOrder9() {
bool l_bool_4;
int l_ticket_0 = OrderSend(Symbol(), OP_BUY, BuyLots9, Ask, 4, 0, 0, "My Expert", 1, 0, Blue);
if (l_ticket_0 > -1) {
OrderSelect(l_ticket_0, SELECT_BY_TICKET);
l_bool_4 = OrderModify(OrderTicket(), OrderOpenPrice(), Ask - BuyStoploss9 * gd_104 * Point, Ask + BuyTakeprofit9 * gd_104 * Point, 0, Blue);
if (l_bool_4 == FALSE) Print("OrderModify() error - ", ErrorDescription(GetLastError()));
} else Print("OrderSend() error - ", ErrorDescription(GetLastError()));
}
int deinit() {
return (0);
} my plan
if the supertrend indicator change to uptrend (green) and the dots are blue (uptrend) > buy
if the supertrend indicator change to downtrend (red) and the dots are red (downtrend) > sell
thank you very much