//+------------------------------------------------------------------+//| XXX 50270694.mq4 |//| Copyright 2021, MetaQuotes Software Corp. |//| https://www.mql5.com |//+------------------------------------------------------------------+//+------------------------------------------------------------------+//| MACD Sample.mq4 |//| Copyright 2005-2014, MetaQuotes Software Corp. |//| http://www.mql4.com |//+------------------------------------------------------------------+#property copyright"2005-2014, MetaQuotes Software Corp."#property link"http://www.mql4.com"inputdouble TakeProfit =50;
inputdouble Lots =0.1;
inputdouble TrailingStop =30;
//+------------------------------------------------------------------+//| |//+------------------------------------------------------------------+voidOnTick(void)
{
double MacdCurrent;
int cnt,ticket,total;
//---// initial data checks// it is important to make sure that the expert works with a normal// chart and the user did not make any mistakes setting external// variables (Lots, StopLoss, TakeProfit,// TrailingStop) in our case, we check TakeProfit// on a chart of less than 100 bars//---if(Bars<100)
{
Print("bars less than 100");
return;
}
if(TakeProfit<10)
{
Print("TakeProfit less than 10");
return;
}
//--- to simplify the coding and speed up access data are put into internal variables
MacdCurrent=iCustom(NULL,0,"ZigZag", 12, 5, 3,0);
total=OrdersTotal();
if(total<1)
{
//--- no opened orders identifiedif(AccountFreeMargin()<(1000*Lots))
{
Print("We have no money. Free Margin = ",AccountFreeMargin());
return;
}
//--- check for long position (BUY) possibilityif(MacdCurrent<MacdCurrent+1)
{
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,Ask+TakeProfit*Point,"macd sample",16384,0,Green);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
Print("BUY order opened : ",OrderOpenPrice());
}
elsePrint("Error opening BUY order : ",GetLastError());
return;
}
//--- check for short position (SELL) possibilityif(MacdCurrent>MacdCurrent+1)
{
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,Bid-TakeProfit*Point,"macd sample",16384,0,Red);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
Print("SELL order opened : ",OrderOpenPrice());
}
elsePrint("Error opening SELL order : ",GetLastError());
}
//--- exit from the "no opened orders" blockreturn;
}
//--- it is important to enter the market correctly, but it is more important to exit it correctly...for(cnt=0; cnt<total; cnt++)
{
if(!OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES))
continue;
if(OrderType()<=OP_SELL && // check for opened position
OrderSymbol()==Symbol()) // check for symbol
{
//--- long position is openedif(OrderType()==OP_BUY)
{
//--- should it be closed?if(MacdCurrent>MacdCurrent+1)
{
//--- close order and exitif(!OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet))
Print("OrderClose error ",GetLastError());
return;
}
//--- check for trailing stopif(TrailingStop>0)
{
if(Bid-OrderOpenPrice()>Point*TrailingStop)
{
if(OrderStopLoss()<Bid-Point*TrailingStop)
{
//--- modify order and exitif(!OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green))
Print("OrderModify error ",GetLastError());
return;
}
}
}
}
else// go to short position
{
//--- should it be closed?if(MacdCurrent<MacdCurrent+1)
{
//--- close order and exitif(!OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet))
Print("OrderClose error ",GetLastError());
return;
}
//--- check for trailing stopif(TrailingStop>0)
{
if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
{
if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
{
//--- modify order and exitif(!OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red))
Print("OrderModify error ",GetLastError());
return;
}
}
}
}
}
}
//---
}
//+------------------------------------------------------------------+
下午好,安德鲁。我给你写信是关于写一份《指标》。我建议创建一个高度反转的指标,而不需要重新评级! (屏幕截图与例子附后)。
我有一个 清晰的ToR形式的优化公式和技术。
ADX的一个变种。从截图(看起来是2015年5月)看截图段之前和截图段之后有什么,打开D1。
寻找一个合作交易商来创建一个免费的联合机器人。
想找一个交易员伙伴,一起创建一个免费的交易机器人。
我有一个想法,***。
如果你有一个想法,请在这里发布。你总是可以选择在自由职业者 那里创造一个有偿工作。
我可以在这里放一个文件,里面有一个简单的工作指标和一些如何改进它的想法吗? 我还不能获得自由职业者。
寻找一个合作交易商来创建一个免费的联合机器人。
对于 "之 "字形,写一个顾问
给我发电子邮件。ToS的网址是: https://docs.google.com/document/d/15Qnx2wCs7NfN-1YmbboWmcHbq1OB2u6XdnIG3za88VU/edit?usp=sharing
我需要帮助来开始写一份顾问报告
我需要帮助来开始写一个EA
例如,该终端有两个EA(MACD样本 和移动平均线)。
我在其中改变了指示器,只是戳了一下,直到我得到一些结果。当我感到厌烦时,我放弃了,又重新开始。
\\\\\\\\\\\\\\\\\\\\\\\
1.首先,以任何名字创建一个专家,并将其从现成的专家中复制到你创建的专家中。
该终端有两个例子的EA(MACD样本 和移动平均)。
我将改变它们的指标,直到我得到一些结果。当我感到厌烦时,我放弃了,又重新开始。
\\\\\\\\\\\\\\\\\\\\\\\
1.第一步是以任何名字创建一个专家,并将其从现成的复制到你创建的专家。
因此,我摸索着找到了这个组合(黄色的地方--我在那里搞了一下)。
\\\\\\\\\\\\\\\\\\\\\
这里是结果