int start() {
total=OrdersTotal();
//--------------------------------------------------------
// エントリー
//--------------------------------------------------------
// 買い?
if(買いの条件) {
OrderSend(Symbol(),OP_BUY,Lot(),Ask,3,Ask-StopLoss*Point,Ask+TakeProfit*Point,"",0,0,Blue);
}
// 売り?
if(売りの条件) {
OrderSend(Symbol(),OP_SELL,Lot(),Bid,3,Bid+StopLoss*Point,Bid-TakeProfit*Point,"",0,0,Red);
}
//--------------------------------------------------------
// エグジット
//--------------------------------------------------------
for(cnt=0;cnt
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
// トレーリングストップ(買いの場合)
if(OrderType()==OP_BUY) {
// ストップの位置を移動できるか(超省略してます)
if(Bid-OrderOpenPrice()>Point*TrailingStop) {
if(OrderStopLoss()
// ストップの位置を移動
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Blue);
return(0);
}
}
// トレーリングストップ(売りの場合)
}else {
// ストップの位置を移動できるか(超省略してます)
if((OrderOpenPrice()-Ask)>(Point*TrailingStop)) {
if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0)) {
// ストップの位置を移動
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);
return(0);
}
}
}
return(0);
}
スポンサーサイト
- http://fxkawase100million.blog67.fc2.com/tb.php/177-fef2f285
0件のトラックバック
コメントの投稿