Jump to content

Recommended Posts

Posted

Re: Fx Profit Moutain Ea

 

/*

Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []

Website: http://purebeam.biz

E-mail : [email protected]

*/

#property copyright "www.fxprofitmountain.net"

#property link ""

 

extern string Remark1 = "+++ Main Settings +++";

extern bool ECN_Broker = FALSE;

extern int MagicNumber = 0;

extern bool AlertMail = FALSE;

extern bool SignalsOnly = FALSE;

extern bool Alerts = FALSE;

extern bool Sound = FALSE;

extern bool EachTickMode = FALSE;

extern double Lots = 0.1;

extern int Slippage = 5;

extern bool UseStopLoss = TRUE;

extern int StopLoss = 100;

extern bool UseTakeProfit = FALSE;

extern int TP = 60;

extern bool UseTrailingStop = TRUE;

extern int TrailingStop = 35;

extern bool MoveStopOnce = FALSE;

extern int MoveStopWhenPrice = 50;

extern int MoveStopTo = 1;

extern bool GBPJPYsettings = FALSE;

extern int K = 5;

extern int D = 3;

extern int S = 3;

int g_bars_176;

int gi_180;

bool gi_184 = FALSE;

double gd_188 = 1.0;

string gs_196;

 

int init() {

g_bars_176 = Bars;

if (EachTickMode) gi_180 = 0;

else gi_180 = 1;

if (Digits == 3 || Digits == 5) {

gd_188 = 10;

if (GBPJPYsettings) {

StopLoss = 130;

TrailingStop = 40;

}

gs_196 = WindowExpertName();

}

return (0);

}

 

int deinit() {

return (0);

}

 

int start() {

int l_ticket_8;

double l_price_12;

double l_price_20;

// if (10000 * Year() + 100 * Month() + Day() >= 20101101) {

// Alert(gs_196 + " expired!");

// return (-1);

// }

// if (AccountNumber() != 1305043 && 1) {

// Alert(gs_196 + " is not licensed to work on this account number!");

// return (-1);

// }

int li_0 = 0;

if (EachTickMode && Bars != g_bars_176) gi_184 = FALSE;

int l_ord_total_4 = OrdersTotal();

li_0 = 0;

double l_iac_28 = iAC(NULL, 0, gi_180 + 0);

double ld_36 = 0;

double l_iac_44 = iAC(NULL, 0, gi_180 + 1);

double ld_52 = 0;

double l_istochastic_60 = iStochastic(NULL, 0, 5, 3, 3, MODE_SMA, 0, MODE_MAIN, gi_180 + 0);

double ld_68 = 50;

double l_iac_76 = iAC(NULL, 0, gi_180 + 0);

double ld_84 = 0;

double l_iac_92 = iAC(NULL, 0, gi_180 + 1);

double ld_100 = 0;

double l_istochastic_108 = iStochastic(NULL, 0, K, D, S, MODE_SMA, 0, MODE_MAIN, gi_180 + 0);

double ld_116 = 50;

double l_iac_124 = iAC(NULL, 0, gi_180 + 0);

double ld_132 = 0;

double l_iac_140 = iAC(NULL, 0, gi_180 + 1);

double ld_148 = 0;

double l_istochastic_156 = iStochastic(NULL, 0, K, D, S, MODE_SMA, 0, MODE_MAIN, gi_180 + 0);

double ld_164 = 50;

double l_iac_172 = iAC(NULL, 0, gi_180 + 0);

double ld_180 = 0;

double l_iac_188 = iAC(NULL, 0, gi_180 + 1);

double ld_196 = 0;

double l_istochastic_204 = iStochastic(NULL, 0, K, D, S, MODE_SMA, 0, MODE_MAIN, gi_180 + 0);

double ld_212 = 50;

bool li_220 = FALSE;

for (int l_pos_224 = 0; l_pos_224 < l_ord_total_4; l_pos_224++) {

OrderSelect(l_pos_224, SELECT_BY_POS, MODE_TRADES);

if (OrderType() <= OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {

li_220 = TRUE;

if (OrderType() == OP_BUY) {

if (l_iac_124 < ld_132 && l_iac_140 > ld_148 && l_istochastic_156 < ld_164) li_0 = 3;

if (li_0 == 3 && (EachTickMode && !gi_184) || (!EachTickMode && Bars != g_bars_176)) {

OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, MediumSeaGreen);

if (AlertMail) SendMail("[signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Close Buy");

if (!EachTickMode) g_bars_176 = Bars;

li_220 = FALSE;

} else {

if (MoveStopOnce && MoveStopWhenPrice > 0) {

if (Bid - OrderOpenPrice() >= Point * (gd_188 * MoveStopWhenPrice)) {

if (OrderStopLoss() < OrderOpenPrice() + Point * (gd_188 * MoveStopTo)) {

OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() + Point * (gd_188 * MoveStopTo), OrderTakeProfit(), 0, Red);

if (!(!EachTickMode)) continue;

g_bars_176 = Bars;

continue;

}

}

}

if (UseTrailingStop && TrailingStop > 0) {

if (Bid - OrderOpenPrice() > Point * (gd_188 * TrailingStop)) {

if (OrderStopLoss() < Bid - Point * (gd_188 * TrailingStop)) {

OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * (gd_188 * TrailingStop), OrderTakeProfit(), 0, MediumSeaGreen);

if (!EachTickMode) g_bars_176 = Bars;

}

}

}

}

} else {

if (l_iac_172 > ld_180 && l_iac_188 < ld_196 && l_istochastic_204 > ld_212) li_0 = 4;

if (li_0 == 4 && (EachTickMode && !gi_184) || (!EachTickMode && Bars != g_bars_176)) {

OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, DarkOrange);

if (AlertMail) SendMail("[signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Close Sell");

if (!EachTickMode) g_bars_176 = Bars;

li_220 = FALSE;

} else {

if (MoveStopOnce && MoveStopWhenPrice > 0) {

if (OrderOpenPrice() - Ask >= Point * (gd_188 * MoveStopWhenPrice)) {

if (OrderStopLoss() > OrderOpenPrice() - Point * (gd_188 * MoveStopTo)) {

OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() - Point * (gd_188 * MoveStopTo), OrderTakeProfit(), 0, Red);

if (!(!EachTickMode)) continue;

g_bars_176 = Bars;

continue;

}

}

}

if (UseTrailingStop && TrailingStop > 0) {

if (OrderOpenPrice() - Ask > Point * (gd_188 * TrailingStop)) {

if (OrderStopLoss() > Ask + Point * (gd_188 * TrailingStop) || OrderStopLoss() == 0.0) {

OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * (gd_188 * TrailingStop), OrderTakeProfit(), 0, DarkOrange);

if (!EachTickMode) g_bars_176 = Bars;

}

}

}

}

}

}

}

if (l_iac_28 > ld_36 && l_iac_44 < ld_52 && l_istochastic_60 > ld_68) li_0 = 1;

if (l_iac_76 < ld_84 && l_iac_92 > ld_100 && l_istochastic_108 < ld_116) li_0 = 2;

if (li_0 == 1 && (EachTickMode && !gi_184) || (!EachTickMode && Bars != g_bars_176)) {

if (!li_220) {

if (AccountFreeMargin() < 1000.0 * Lots) {

Print("We have no money. Free Margin = ", AccountFreeMargin());

return (0);

}

if (UseStopLoss) l_price_12 = Ask - gd_188 * StopLoss * Point;

else l_price_12 = 0.0;

if (UseTakeProfit) l_price_20 = Ask + gd_188 * TP * Point;

else l_price_20 = 0.0;

if (ECN_Broker) {

l_ticket_8 = OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, 0, 0, "Buy(#" + MagicNumber + ")" + Symbol() + "", MagicNumber, 0, DodgerBlue);

if (l_ticket_8 > 0) {

OrderSelect(l_ticket_8, SELECT_BY_TICKET);

OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(l_price_12, Digits), NormalizeDouble(l_price_20, Digits), 0, Red);

}

} else l_ticket_8 = OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, l_price_12, l_price_20, "Buy(#" + MagicNumber + ")" + Symbol() + "", MagicNumber, 0, DodgerBlue);

if (l_ticket_8 > 0) {

if (OrderSelect(l_ticket_8, SELECT_BY_TICKET, MODE_TRADES)) {

Print("BUY order opened : ", OrderOpenPrice());

if (AlertMail) SendMail("[signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Open Buy");

} else Print("Error opening BUY order : ", GetLastError());

}

if (SignalsOnly) {

if (AlertMail) SendMail("[signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + "Buy Signal");

if (Alerts) Alert("[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + "Buy Signal");

if (Sound) PlaySound("alert.wav");

}

if (!li_220 && !SignalsOnly) {

if (AlertMail) SendMail("[signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + "Buy Signal");

if (Alerts) Alert("[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + "Buy Signal");

if (Sound) PlaySound("alert.wav");

if (EachTickMode) gi_184 = TRUE;

if (!EachTickMode) g_bars_176 = Bars;

return (0);

}

}

}

if (li_0 == 2 && (EachTickMode && !gi_184) || (!EachTickMode && Bars != g_bars_176)) {

if (!li_220) {

if (AccountFreeMargin() < 1000.0 * Lots) {

Print("We have no money. Free Margin = ", AccountFreeMargin());

return (0);

}

if (UseStopLoss) l_price_12 = Bid + gd_188 * StopLoss * Point;

else l_price_12 = 0.0;

if (UseTakeProfit) l_price_20 = Bid - gd_188 * TP * Point;

else l_price_20 = 0.0;

if (ECN_Broker) {

l_ticket_8 = OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, 0, 0, "Sell(#" + MagicNumber + ")" + Symbol() + "", MagicNumber, 0, DeepPink);

if (l_ticket_8 > 0) {

OrderSelect(l_ticket_8, SELECT_BY_TICKET);

OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(l_price_12, Digits), NormalizeDouble(l_price_20, Digits), 0, Red);

}

} else l_ticket_8 = OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, l_price_12, l_price_20, "Sell(#" + MagicNumber + ")" + Symbol() + "", MagicNumber, 0, DeepPink);

if (l_ticket_8 > 0) {

if (OrderSelect(l_ticket_8, SELECT_BY_TICKET, MODE_TRADES)) {

Print("SELL order opened : ", OrderOpenPrice());

if (AlertMail) SendMail("[signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Open Sell");

} else Print("Error opening SELL order : ", GetLastError());

}

if (SignalsOnly) {

if (AlertMail) SendMail("[signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + "Sell Signal");

if (Alerts) Alert("[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + "Sell Signal");

if (Sound) PlaySound("alert.wav");

}

if (!li_220 && !SignalsOnly) {

if (AlertMail) SendMail("[signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + "Sell Signal");

if (Alerts) Alert("[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + "Sell Signal");

if (Sound) PlaySound("alert.wav");

if (EachTickMode) gi_184 = TRUE;

if (!EachTickMode) g_bars_176 = Bars;

return (0);

}

}

if (!EachTickMode) g_bars_176 = Bars;

}

return (0);

}

//kudos welcom

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...