//+------------------------------------------------------------------+ //| Signal Exit Buy / Exit Sell) //| Iterate through open tickets //+------------------------------------------------------------------+
//+------------------------------------------------------------------+ //| Signal Exit Buy / Exit Sell) //| Iterate through open tickets //+------------------------------------------------------------------+
//+-------------------------------------------------------------------------+ //| Signal close Buy / close Sell / Open new BUY or SELL order when possible
int PositionIndex; int TotalNumberOfOrders; TotalNumberOfOrders = OrdersTotal();// store number of Orders in the variable
for(PositionIndex = TotalNumberOfOrders - 1; PositionIndex >= 0 ; PositionIndex --)// for loop to loop through all Orders . . COUNT DOWN TO ZERO ! { if(!OrderSelect(PositionIndex, SELECT_BY_POS, MODE_TRADES)) continue;// if the OrderSelect fails advance the loop to the next PositionIndex
if(OrderMagicNumber() == MagicNumber // does the Order's Magic Number match our EA's magic number ? && OrderSymbol() == Symbol() // does the Order's Symbol match the Symbol our EA is working on ? && (OrderType() == OP_BUY// is the Order a Buy Order ? || OrderType() == OP_SELL )) // or is it a Sell Order ?
if (! OrderClose( OrderTicket(), OrderLots(), OrderClosePrice(), Slippage*PipMultiplier,DarkOrange )) //try to close the order Print("Order Close failed, order number: ", OrderTicket(), " Error: ", GetLastError()); //if the Order Close failed print some helpful information
if(trendNow>0 && (NLD1>NLD2) && RSIfilter>52) // Check if new entry condition is given { OpenBuy_=true; } else if(trendPrev>0 && (NLD1<NLD2) && RSIfilter<42) { OpenSell_=true; } } // end of For loop
//+-------------------------------------------------------------------------+ //| Signal close Buy / close Sell / Open new BUY or SELL order when possible
int PositionIndex; int TotalNumberOfOrders; TotalNumberOfOrders = OrdersTotal();// store number of Orders in the variable
for(PositionIndex = TotalNumberOfOrders - 1; PositionIndex >= 0 ; PositionIndex --)// for loop to loop through all Orders . . COUNT DOWN TO ZERO ! { if(!OrderSelect(PositionIndex, SELECT_BY_POS, MODE_TRADES)) continue;// if the OrderSelect fails advance the loop to the next PositionIndex
if(OrderMagicNumber() == MagicNumber // does the Order's Magic Number match our EA's magic number ? && OrderSymbol() == Symbol() // does the Order's Symbol match the Symbol our EA is working on ? && (OrderType() == OP_BUY// is the Order a Buy Order ? || OrderType() == OP_SELL )) // or is it a Sell Order ?
if (! OrderClose( OrderTicket(), OrderLots(), OrderClosePrice(), Slippage*PipMultiplier,DarkOrange )) //try to close the order Print("Order Close failed, order number: ", OrderTicket(), " Error: ", GetLastError()); //if the Order Close failed print some helpful information
if(trendNow>0 && (NLD1>NLD2) && RSIfilter>52) // Check if new entry condition is given { OpenBuy_=true; } else if(trendPrev>0 && (NLD1<NLD2) && RSIfilter<42) { OpenSell_=true; } } // end of For loop
Here is the EA for B& S with 15 warnings left. If some one could tell me how to clear Declaration of global such as “declaration of 'trailingprofit' hides global declaration at line 62 mnt-BuyersSellers EA v1.00.mq4 915 53” I will clear it up.
I also need a few files to run it.
2016.12.17 16:01:35.347 2016.11.01 00:47 cannot open file 'C:\FXPrograms\Tallinex\MQL4\indicators\4BARS-MTF-BBH 1.06.ex4' [2]
2016.12.17 16:01:29.815 2016.11.01 00:17 cannot open file 'C:\FXPrograms\Tallinex\MQL4\indicators\BullBearHelper 1.00.ex4' [2]
2016.12.17 16:01:29.815 2016.11.01 00:17 cannot open file 'C:\FXPrograms\Tallinex\MQL4\indicators\AdaptiveLaguerreFilter.ex4' [2]
こんにちは、プロコーダーズです。
どなたか助けていただけないでしょうか。
私は、私のEAがトレンドの変化で買い取引を開始し、既存の売り取引を終了したいと思います。
それはしますが、それは利益を取ったときだけです。ポジションがまだ開いているときにトレンドが変わると
StopLossで実行されます。(写真参照)。うまくいくときといかないときがあります。
何を改善すればいいのでしょうか?
if(trendNow>0 && (NLD1>NLD2) && RSIfilter>55)
{
OpenBuy_ =true;
CloseSell_=true;
}
else
if(trendPrev>0 && (NLD1<NLD2) && RSIfilter<45)
{
OpenSell_=true;
CloseBuy_=true;
}
このコードだけでは結論は出ません。
こんにちは、Mladen。
私の問題を調べていただき、ありがとうございます。
以下のコードで、既存の売りと買いの注文をクローズします。
また、トレンドが正しい方向に向かえば、新しい買いまたは売り注文 を開くはずです。
//+------------------------------------------------------------------+
//| Signal Exit Buy / Exit Sell)
//| Iterate through open tickets
//+------------------------------------------------------------------+
for(int i=0; i<Total; i++)
{
dummyResult=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderType()<=OP_SELL && OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY && OrderMagicNumber()==MagicNumber)
{
for(int z=OrdersTotal()-1; z>=0; z--)
{
if(OrderSelect(z,SELECT_BY_POS,MODE_TRADES) && OrderMagicNumber()==MagicNumber && OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY)
buy_ticket=OrderTicket();
else
if(OrderType()== OP_SELL)
sell_ticket=OrderTicket();
}
// Close BUY
if(CloseBuy_==true && buy_ticket!=0)
{
dummyResult=OrderClose(OrderTicket(),OrderLots(),Bid,Slippage*PipMultiplier,MediumSeaGreen);
if(EachTickMode) TickCheck = True;
if(!EachTickMode) BarCount = Bars;
Print("Error closing Buy #",(string)OrderTicket()," Error code ",(string)GetLastError());
// Open new Sell Order
if(trendPrev>0 && (NLD1<NLD2) && RSIfilter<45) OpenSell_=true;
}
// Close SELL
if(CloseSell_==true && sell_ticket!=0)
{
dummyResult=OrderClose(OrderTicket(),OrderLots(),Ask,Slippage*PipMultiplier,DarkOrange);
if(EachTickMode) TickCheck = True;
if(!EachTickMode) BarCount = Bars;
Print("Error closing Sell #",(string)OrderTicket()," Error code ",(string)GetLastError());
// Open new Buy Order
if(trendNow>0 && (NLD1>NLD2) && RSIfilter>55) OpenBuy_ =true;
}
Mladenさん、こんにちは。
私の問題を調べていただき、ありがとうございます。
以下のコードで、既存の売りと買いの注文をクローズします。
また、トレンドが正しい方向に向かえば、新しい買いまたは売りの注文を出すはずです...
//+------------------------------------------------------------------+
//| Signal Exit Buy / Exit Sell)
//| Iterate through open tickets
//+------------------------------------------------------------------+
for(int i=0; i<Total; i++)
{
dummyResult=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderType()<=OP_SELL && OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY && OrderMagicNumber()==MagicNumber)
{
for(int z=OrdersTotal()-1; z>=0; z--)
{
if(OrderSelect(z,SELECT_BY_POS,MODE_TRADES) && OrderMagicNumber()==MagicNumber && OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY)
buy_ticket=OrderTicket();
else
if(OrderType()== OP_SELL)
sell_ticket=OrderTicket();
}
// Close BUY
if(CloseBuy_==true && buy_ticket!=0)
{
dummyResult=OrderClose(OrderTicket(),OrderLots(),Bid,Slippage*PipMultiplier,MediumSeaGreen);
if(EachTickMode) TickCheck = True;
if(!EachTickMode) BarCount = Bars;
Print("Error closing Buy #",(string)OrderTicket()," Error code ",(string)GetLastError());
// Open new Sell Order
if(trendPrev>0 && (NLD1<NLD2) && RSIfilter<45) OpenSell_=true;
}
// Close SELL
if(CloseSell_==true && sell_ticket!=0)
{
dummyResult=OrderClose(OrderTicket(),OrderLots(),Ask,Slippage*PipMultiplier,DarkOrange);
if(EachTickMode) TickCheck = True;
if(!EachTickMode) BarCount = Bars;
Print("Error closing Sell #",(string)OrderTicket()," Error code ",(string)GetLastError());
// Open new Buy Order
if(trendNow>0 && (NLD1>NLD2) && RSIfilter>55) OpenBuy_ =true;
}
なぜ、ループの中でループを使っているのですか?その必要は全くありません。これを取り除くと、コードが単純化されたときに、すべてが簡単に片付くようになります。
こんにちは、Mladen。
それに合わせてコードを修正しましたが、より良くなったと思いますか?
見ていただけませんか?このコードはまだ擬似的なものであり、テストはしていません。
ありがとうございました。
//+-------------------------------------------------------------------------+
int PositionIndex;//| Signal close Buy / close Sell / Open new BUY or SELL order when possible
int TotalNumberOfOrders;
TotalNumberOfOrders = OrdersTotal();// store number of Orders in the variable
for(PositionIndex = TotalNumberOfOrders - 1; PositionIndex >= 0 ; PositionIndex --)// for loop to loop through all Orders . . COUNT DOWN TO ZERO !
{
if(!OrderSelect(PositionIndex, SELECT_BY_POS, MODE_TRADES)) continue;// if the OrderSelect fails advance the loop to the next PositionIndex
if(OrderMagicNumber() == MagicNumber // does the Order's Magic Number match our EA's magic number ?
&& OrderSymbol() == Symbol() // does the Order's Symbol match the Symbol our EA is working on ?
&& (OrderType() == OP_BUY // is the Order a Buy Order ?
|| OrderType() == OP_SELL )) // or is it a Sell Order ?
if (! OrderClose( OrderTicket(), OrderLots(), OrderClosePrice(), Slippage*PipMultiplier,DarkOrange )) //try to close the order
Print("Order Close failed, order number: ", OrderTicket(), " Error: ", GetLastError()); //if the Order Close failed print some helpful information
if(trendNow>0 && (NLD1>NLD2) && RSIfilter>52) // Check if new entry condition is given
{
OpenBuy_=true;
}
else
if(trendPrev>0 && (NLD1<NLD2) && RSIfilter<42)
{
OpenSell_=true;
}
} // end of For loop
こんにちは、Mladen。
それに合わせてコードを修正しましたが、より良くなったと思いますか?
見ていただけませんか?このコードはまだ擬似的なものであり、テストはしていません。
ありがとうございました。
//+-------------------------------------------------------------------------+
int PositionIndex;//| Signal close Buy / close Sell / Open new BUY or SELL order when possible
int TotalNumberOfOrders;
TotalNumberOfOrders = OrdersTotal();// store number of Orders in the variable
for(PositionIndex = TotalNumberOfOrders - 1; PositionIndex >= 0 ; PositionIndex --)// for loop to loop through all Orders . . COUNT DOWN TO ZERO !
{
if(!OrderSelect(PositionIndex, SELECT_BY_POS, MODE_TRADES)) continue;// if the OrderSelect fails advance the loop to the next PositionIndex
if(OrderMagicNumber() == MagicNumber // does the Order's Magic Number match our EA's magic number ?
&& OrderSymbol() == Symbol() // does the Order's Symbol match the Symbol our EA is working on ?
&& (OrderType() == OP_BUY // is the Order a Buy Order ?
|| OrderType() == OP_SELL )) // or is it a Sell Order ?
if (! OrderClose( OrderTicket(), OrderLots(), OrderClosePrice(), Slippage*PipMultiplier,DarkOrange )) //try to close the order
Print("Order Close failed, order number: ", OrderTicket(), " Error: ", GetLastError()); //if the Order Close failed print some helpful information
if(trendNow>0 && (NLD1>NLD2) && RSIfilter>52) // Check if new entry condition is given
{
OpenBuy_=true;
}
else
if(trendPrev>0 && (NLD1<NLD2) && RSIfilter<42)
{
OpenSell_=true;
}
} // end of For loop
Mntiwana
Here is the EA for B& S with 15 warnings left. If some one could tell me how to clear Declaration of global such as “declaration of 'trailingprofit' hides global declaration at line 62 mnt-BuyersSellers EA v1.00.mq4 915 53” I will clear it up.
I also need a few files to run it.
2016.12.17 16:01:35.347 2016.11.01 00:47 cannot open file 'C:\FXPrograms\Tallinex\MQL4\indicators\4BARS-MTF-BBH 1.06.ex4' [2]
2016.12.17 16:01:29.815 2016.11.01 00:17 cannot open file 'C:\FXPrograms\Tallinex\MQL4\indicators\BullBearHelper 1.00.ex4' [2]
2016.12.17 16:01:29.815 2016.11.01 00:17 cannot open file 'C:\FXPrograms\Tallinex\MQL4\indicators\AdaptiveLaguerreFilter.ex4' [2]
And ,"Slope Direction Line"
Let me Know
Ray
トレーダーデューク
ご興味をお持ちいただきありがとうございます。Indiパッケージが添付されていますが、実はシステム全体はFF (http://www.tradingsystemforex.com/ideas-for-expert-advisors/4662-buyers-sellers-ea.html)のものなのです。
gspeはそれに取り組んでいたが、私は全体のEAフレームは "funyoo "からだと思うし、私はいくつかの新しいEAを作成するためのサンプル/モデルフレームとしてEAコードにのみ興味があります、彼らの戦略の残りの部分は、私の推測に従って、フルーツフルではありません、我々はそれ以上のものを形成できる、我々は今のところ100倍良い指標を持っている:)
よろしくお願いします。
「crsnapebtinternetcom"とMLADEN ...そして私はテストし、それが動作しましたが、いくつかの認証が必要です:)。
よろしくお願いします。
トレーダーデューク
ご興味をお持ちいただきありがとうございます。Indiパッケージが添付されていますが、実はシステム全体はFF (http://www.tradingsystemforex.com/ideas-for-expert-advisors/4662-buyers-sellers-ea.html)のものなのです。
gspeはそれに取り組んでいたが、私は全体のEAフレームは "funyoo "からだと思うし、私はいくつかの新しいEAを作成するためのサンプル/モデルフレームとしてEAコードにのみ興味があります、彼らの戦略の残りの部分は、私の推測に従って、フルーツフルではありません、我々はそれ以上のものを形成できる、我々は今のところ100倍良い指標を持っている:)
よろしくお願いします。
みんな
FunyoosのEAは、バックテストでマーチンゲールを使用した場合、通常良い結果を示しています。使用する際には十分な注意が必要です。