Questões básicas ... - página 6

 
 

MTF RWI Trigger??

Como eu programaria um gatilho de compra para todos os verdes e um gatilho de venda para todos os vermelhos para estes indicadores? Por favor, ajude...

Nick,

Arquivos anexados:
 

EA por apenas uma vez por carrapato

Ei, pessoal,

Não sei se isto já foi postado antes (falta-me a paciência de procurar através dos fios, desculpe!), mas sei que já foi muito solicitado.

Este código será executado SOMENTE uma vez por tick. Ele será executado assim que um novo tick for introduzido, e somente então, e não funcionará depois, até que outro ocorra.

Por favor, tenha em mente que isso pode realmente ser um problema, às vezes. Se seus pedidos não passarem, por qualquer razão, não serão iniciados novamente. Se você quiser modificar o código para fazer isso, vá em frente. Eu sugeriria algo como:

if order fails, fileseek to front of f, write Open[2] to f

Isto fará com que o próximo tique acredite que é um novo.

Arquivos anexados:
newtick.mq4  3 kb
 

Existem livros, tutoriais online ou vídeos sobre como escrever MQL4?

 

Olá a todos,

Preciso de ajuda para codificar isto:

Com base em um gráfico diário:

a) Digamos que minhas condições são cumpridas no encerramento do dia#1 e vamos supor que o dia# é 9 de junho.

b) Agora quero colocar uma BUY-Stop e uma sell-stop na High and Low no fechamento do dia #2 ou 10 de junho.

c) Finalmente, quero que o comércio seja acionado no dia nº 3.

Além disso, se o LONG for acionado primeiro, quero que a parada de venda seja fechada e vice-versa.

Obrigado antecipadamente por sua ajuda.

cumprimentos,

forexcel

 

EA para nomeação do dia de uma semana, e horário

Você não sabe qual EA você escolhe o dia,(Por exemplo, apenas quarta-feira e quinta-feira) and indica o horário de abertura e fechamento?

Em muitos casos,

Uma taxa sobe na quarta-feira and Thursday desde que muitas pessoas conseguiram o SWAP.

Eu o compro neste momento e tomo uma posição.

E a taxa cai assim que ocorre um SWAP.

Eu sou vendido neste momento e tomo uma posição.

Estou procurando a EA para usar para este tipo de comércio.

 

Eu preciso de ajuda!

Oi, pessoal,

Eu preciso de ajuda. Eu tenho esta EA que criei

#define SIGNAL_NONE 0

#define SIGNAL_BUY 1

#define SIGNAL_SELL 2

#define SIGNAL_CLOSEBUY 3

#define SIGNAL_CLOSESELL 4

#property copyright "FxAttack"

#property link "http://www.ioinvesto.com"

extern int MagicNumber = 0;

extern bool SignalMail = False;

extern bool EachTickMode = True;

extern double Lots = 0.1;

extern int Slippage = 3;

extern bool UseStopLoss = True;

extern int StopLoss = 25;

extern bool UseTakeProfit = True;

extern int TakeProfit = 25;

extern bool UseTrailingStop = False;

extern int TrailingStop = 30;

extern bool Use.Time.Filter = true;

extern string Server.Time.To.Start = "00:00";

extern string Server.Time.To.Stop = "17:00";

extern bool Not.Trade.Fri.Sun = True;

int BarCount;

int Current;

bool TickCheck = False;

//+------------------------------------------------------------------+

//| expert initialization function |

//+------------------------------------------------------------------+

int init() {

BarCount = Bars;

if (EachTickMode) Current = 0; else Current = 1;

return(0);

}

//+------------------------------------------------------------------+

//| expert deinitialization function |

//+------------------------------------------------------------------+

int deinit() {

return(0);

}

//+------------------------------------------------------------------+

//| expert start function |

//+------------------------------------------------------------------+

int start() {

int Order = SIGNAL_NONE;

int Total, Ticket;

double StopLossLevel, TakeProfitLevel;

if (EachTickMode && Bars != BarCount) TickCheck = False;

Total = OrdersTotal();

Order = SIGNAL_NONE;

//+------------------------------------------------------------------+

//| Variable Begin |

//+------------------------------------------------------------------+

double OpenPrice = iOpen(NULL, PERIOD_D1, Current + 0);

double Buy_Sign = (OpenPrice + (30*Point));

double Sell_Sign = (OpenPrice - (30*Point));

double start_time = StrToTime(TimeToStr(TimeCurrent(), TIME_DATE) + " " + Server.Time.To.Start);

double end_time = StrToTime(TimeToStr(TimeCurrent(), TIME_DATE) + " " + Server.Time.To.Stop);

Comment("Open Price = ",OpenPrice);

//+------------------------------------------------------------------+

//| Variable End |

//+------------------------------------------------------------------+

if(Use.Time.Filter && (TimeCurrent() = end_time)) return(0);

if(Not.Trade.Fri.Sun && (DayOfWeek()==6 || DayOfWeek()==1 )) return(0);

//Check position

bool IsTrade = False;

for (int i = 0; i < Total; i ++) {

OrderSelect(i, SELECT_BY_POS, MODE_TRADES);

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

IsTrade = True;

if(OrderType() == OP_BUY) {

//Close

//+------------------------------------------------------------------+

//| Signal Begin(Exit Buy) |

//+------------------------------------------------------------------+

//+------------------------------------------------------------------+

//| Signal End(Exit Buy) |

//+------------------------------------------------------------------+

if (Order == SIGNAL_CLOSEBUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {

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

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

if (!EachTickMode) BarCount = Bars;

IsTrade = False;

continue;

}

//Trailing stop

if(UseTrailingStop && TrailingStop > 0) {

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

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

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

if (!EachTickMode) BarCount = Bars;

continue;

}

}

}

} else {

//Close

//+------------------------------------------------------------------+

//| Signal Begin(Exit Sell) |

//+------------------------------------------------------------------+

//+------------------------------------------------------------------+

//| Signal End(Exit Sell) |

//+------------------------------------------------------------------+

if (Order == SIGNAL_CLOSESELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {

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

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

if (!EachTickMode) BarCount = Bars;

IsTrade = False;

continue;

}

//Trailing stop

if(UseTrailingStop && TrailingStop > 0) {

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

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

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

if (!EachTickMode) BarCount = Bars;

continue;

}

}

}

}

}

}

//+------------------------------------------------------------------+

//| Signal Begin(Entry) |

//+------------------------------------------------------------------+

if (Bid > Buy_Sign) Order = SIGNAL_BUY;

if (Ask < Sell_Sign) Order = SIGNAL_SELL;

//+------------------------------------------------------------------+

//| Signal End |

//+------------------------------------------------------------------+

//Buy

if (Order == SIGNAL_BUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {

if(!IsTrade) {

//Check free margin

if (AccountFreeMargin() < (1000 * Lots)) {

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

return(0);

}

if (UseStopLoss) StopLossLevel = Ask - StopLoss * Point; else StopLossLevel = 0.0;

if (UseTakeProfit) TakeProfitLevel = Ask + TakeProfit * Point; else TakeProfitLevel = 0.0;

Ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, StopLossLevel, TakeProfitLevel, "MaxPower Buy Order", MagicNumber, 0, DodgerBlue);

if(Ticket > 0) {

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

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

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

} else {

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

}

}

if (EachTickMode) TickCheck = True;

if (!EachTickMode) BarCount = Bars;

return(0);

}

}

//Sell

if (Order == SIGNAL_SELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {

if(!IsTrade) {

//Check free margin

if (AccountFreeMargin() < (1000 * Lots)) {

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

return(0);

}

if (UseStopLoss) StopLossLevel = Bid + StopLoss * Point; else StopLossLevel = 0.0;

if (UseTakeProfit) TakeProfitLevel = Bid - TakeProfit * Point; else TakeProfitLevel = 0.0;

Ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, StopLossLevel, TakeProfitLevel, "MaxPower Sell Order", MagicNumber, 0, DeepPink);

if(Ticket > 0) {

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

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

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

} else {

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

}

}

if (EachTickMode) TickCheck = True;

if (!EachTickMode) BarCount = Bars;

return(0);

}

}

if (!EachTickMode) BarCount = Bars;

return(0);

}

//+------------------------------------------------------------------+[/PHP]

......but I don't understand how to put the code below inner it.

[PHP]...

for (int i=0; i<OrdersTotal(); i++) {

if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {

if (OrderSymbol()==Symbol() )

return(0);

....

O último bloco de código que escrevi é: "Se uma ordem em um SYMBOL já foi aberta, não abra novas ordens nesse SYMBOL".

Alguém pode me ajudar a integrá-lo?

Obrigado,

Mauro

 

A EA só faz uma profissão...

Ei, pessoal, tenho uma pergunta rápida para vocês. Eu criei recentemente uma EA. Os parâmetros estão corretos e quando o adicionei ao gráfico, ele colocou uma Compra apropriada e depois uma Venda. Mas, da próxima vez que um sinal de Compra veio, ele nunca colocou uma troca. Parece que a EA só está aceitando a primeira troca e depois nenhuma depois. Alguma idéia do porquê disso? Agradecia qualquer ajuda. Obrigado!!!

 

Talvez seja uma idéia para mostrar a e? Então podemos olhar para o código?

Razão: