//+------------------------------------------------------------------+//| 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;
}
}
}
}
}
}
//---
}
//+------------------------------------------------------------------+
アンドリュー こんにちは。Indicatorの執筆 について書かせていただきます。再格付けをしないHIGHLY REVERSEインジケーターの 作成を提案します! (画面例を添付)。
私は、明確なToRという形で、「最適化の数式と技術」を持って います。
ADXのバリエーション。スクリーンショット(2015年5月のようです)から、スクリーンショット区間の前にあったもの、スクリーンショット区間の後にあったものを見て、D1を開いてください。
無料のジョイントロボットを作成するためのパートナートレーダーを探しています。
一緒に無料取引ロボットを作るパートナートレーダーを探しています。
いいこと思いついたよ、***。
アイデアをお持ちの方は、ここに投稿してください。また、Freelanceでは 常に有償の仕事を作成することができます。
簡単な動作のインジケータとそれを改善するためのアイデアをここにファイルとして置いてもいいですか? まだフリーランスになれないんです。
無料のジョイントロボットを作成するためのパートナートレーダーを探しています。
ジグザグには、アドバイザーを書く
メールで問い合わせるToSは、https://docs.google.com/document/d/15Qnx2wCs7NfN-1YmbboWmcHbq1OB2u6XdnIG3za88VU/edit?usp=sharing。
アドバイザーの書き始めを手伝ってほしい
EAを書き始めるのを手伝ってほしい
この端末には、例えば2つのEA(MACDサンプルと移動平均)があります。
その中でインジケーターを変え、結果が出るまでつつくだけ。飽きたら諦めて、また最初からやり直す。
\\\\\\\\\\\\\\\\\\\\\\\
1.まず、任意の名前でExpertを作成し、既製のものから作成したものにコピーします。
ターミナルには2つのEA(MACDサンプルとMoving Average)の例があります。
結果が出るまで、インジケーターを変えてみたりして。飽きたら諦めて、また最初からやり直す。
\\\\\\\\\\\\\\\\\\\\\\\
1.まず、任意の名前でエキスパートを作成し、それをレディメイドから作成したものにコピーします。
そこで、手探りでこの組み合わせ(黄色いところ~ねじ込んだところ)にたどり着いたのです。
\\\\\\\\\\\\\\\\\\\\\
以下はその結果です。