From 藍色投機客

系統的細節說明如下:

Setup : 開盤後等待一個小時,然後抓取開盤後第一個小時的高點和低點。(一個小時只是範例,可以依據市場調整)
Entry : 開盤區間的時間過後,突破區間高點+2檔進場做多,跌破區間低點-2點進場做空。(+ - 2點只是一個簡單的濾網,是要防止價格點到區間高/低點就回頭,而不是真突破)。每天每個方向只進場一次,以防止當天盤整盤,導致反覆進場。
Exit : 收盤出場。或者可以根據每個人不同的個性,採用不同的出場方式。Profit Target, StopLoss, Percent Trailing, ATR Trailing, Channel Trailing等不同的出場法都可以用。不過原則就是收盤前一定要出場。

input :
ORBeginTime(0845), // Opening Range Begin Time
OREndTime(0945), // Opening Range End Time
NoTradeTime(1300); // Don't place order after 13:00

var :
ORHigh(0),
ORLow(99999),
AlreadyBuyFlag(false),
AlreadySellFlag(false);

SetStopContract;


if date <> date[1] then begin //reset all data at begin of a new day
ORHigh = 0;
ORLow = 99999;
AlreadyBuyFlag = False;
AlreadySellFlag = False;
end;

if entrytime(0) = time and marketposition(0) = 1 then AlreadyBuyFlag = true; //if entry at this bar and don't exit at this bar
if entrytime(0) = time and marketposition(0) = -1 then AlreadySellFlag = true;

if entrytime(1) = time and marketposition(1) = 1 then AlreadyBuyFlag = true; // if entry & exit at this same bar
if entrytime(1) = time and marketposition(1) = -1 then AlreadySellFlag = true;


if ORBeginTime < Time and Time <= OREndTime then begin //Get Opening Range High & Low
ORHigh = maxlist(ORHigh, High);
ORLow = minlist(ORLow, Low);
end;

if Time = OREndTime then begin // Draw Opening Range Line & breakout line
Value1 = TL_New(Date,ORBeginTime,ORHigh,Date,OREndTime,ORHigh);
Value2 = TL_New(Date,ORBeginTime,ORLow,Date,OREndTime,ORLow);
Value3 = TL_New(Date,ORBeginTime,ORHigh+2*(MinMove / PriceScale),Date,OREndTime,ORHigh+2*(MinMove / PriceScale));
Value4 = TL_New(Date,ORBeginTime,ORLow- 2*(MinMove / PriceScale),Date,OREndTime,ORLow- 2*(MinMove / PriceScale));
end;

if OREndTime < Time and Time < NoTradeTime then begin //Place order for entry
if AlreadyBuyFlag = false then buy ("ORB LE") next bar at ORHigh + 2*(MinMove / PriceScale) stop;
if AlreadySellFlag = false then sellshort ("ORB SE") next bar at ORLow - 2*(MinMove / PriceScale) stop;
end;


setexitonclose;

arrow
arrow
    全站熱搜

    JinShiang 發表在 痞客邦 留言(1) 人氣()