※進出場指令
多單進場 If……….Then Buy this bar close
多單出場 If……….Then Sell this bar close
空單進場 If……….Then SellShort this bar close
空單出場 If……….Then BuytoCover this bar close
※交叉指令
交叉向上 Cross
Above or Cross
over
交叉向下 Cross
Below or Cross
under
※BarType
0 = Tick Bar or Volumn Bar
1 = Intraday Bar
2 = Daily Bar
3 = Weekly Bar
4 = Monthly Bar
5 = Point & Fingure
※BarInterval
Return the IntraDay IntraDay Interval Value
BarInterval = 5 è 5min
※CurrentBar & BarInterval
Return the number of the current calculating bar ; BarInterval[1]
※Bar Price Data
Open , High , Low , Close
OpenD(0) , High D(0) , Low D(0) , Close D(0) è 當日
OpenD(1) , High D(1) , Low D(1) , Close D(1) è 前一日
※日期指令
Date 目前處理資料的日期
CurrentDate 作業系統目前的日期
ELDate(yyyy, mm, dd) 將一般日期轉換成EL的日期格式 yyymmdd
DateToJulian(Date) 將EL的日期格式轉換成自1900/1/1 的天數
JulianToDate(jDate) 將天數轉換成EL的日期格式
※時間指令
Time 目前處理資料的時間格式
CurrentTime 作業系統目前的時間
TimeToMinutes(Time) 將EL的時間格式轉換成幾分鐘
MinutesToTime(mTime) 將幾分鐘轉成EL的時間格式
時間運算:
MinutesToTime( TimeToMinutes(Time)+20 )
Time=850 , TimeToMinutes(Time) = 530 ; Time=1345 ,
TimeToMinutes(Time) = 825
※宣告
Input : N(0);
Var : Value1(0);
Var : MyTF1(false);
Var : MyStrung(“abc”);
Array : MyArray[5](0);
Array : MyTFArray[5](False);
Array : MyTextArray[5](“”);
Array : MyArray[6][3];
※Array Function
SummationArray(MyArray, Size);
SortArray(MyArray, Size, HiLo );
AverageArray(ArrayName, Size);
※Dynamic Arrays
Array : MyDyArray[](0);
Array_SetMaxIndex(MyDyArray, Count);
※Dynamic Arrays Function
Array_Sum(MyArray, BeginNum, EndNum);
Array_Sort(MyArray, BeginNum, EndNum, SortOrder);
※判斷條件語法
If …… Then
……
Else
…… ;
If …… Then
Begin
…… ;
…… ;
End;
If …… Then Begin
…… ;
End Else If …… Then Begin
…… ;
End Else Begin
…… ;
End ;
Once(……) Begin
…… ;
End ;
※判斷迴圈語法
For Value1=A To (or DownTo) B Begin
…… ;
End;
While …… Begin
…… ;
End;
Repeat
Value1=Value1+1;
Until Value1=10;
※PlotN 語法 N=1…99
Plot i (num, “plot name”, fg-color, bg-color, width ) ;
Plot1[+/-N]() ; è Displace Plots
※Alert 語法
Alert( “Alert Message” + GetSymbolName )
※ MarketPosition
MarketPosition = -1 ; 空單
MarketPosition = 0 ; 無部位
MarketPosition = 1 ; 多單
※ EntryPrice 進場價
If MarketPosition =1 then sell next bar at EntryPrice-10 Stop
※ BarsSinceEntry 自進場以來經過幾根Bar
If MarketPosition = 1 and BarsSinceEntry > 5 then
Sell next Bar at Market ;
※ OpenPositionProfit 未平倉損益
Input : ProfitExit(200);
If OpenPositionProfit >= ProfitExit then begin
Sell next bar at Market ;
BuytoCover next bar at Market ;
End;
停利程式
※ 內建出場機制
SetBreakEven(Amt) 獲利超過Amt金額 卻又回到成本時出場
SetDollarTrailing(Dollar) 進場後從最高點回落Dollar金額後出場
SetPercentTrailing(Amt, Percent) 進場後達到獲利Amt起,自高點回落Percent百分比後出場
SetProfitTarget(Dollar) 停利
SetStopLoss(Dollar) 總損益停損
SetStopContract 每口停損(宣告) 有SetXXX指令,就可以使用
SetExitOnClose 交易收盤出場
※ Exit from Entry
If time=0900 then Buy(“Buy1” )
next bar 1 shares at market;
If time=1000 then Buy(“Buy2” )
next bar 1 shares at market;
If time=1100 then Sell(“Sell1” ) next bar From Entry(“Buy1” ) 1 shares at market;
If time=1200 then Sell(“Sell2” ) next bar From Entry(“Buy2” ) 1 shares at market;
SetExitOnClose;
※ BigPointValue 每一點價值
PriceScale 價格單位分母部份
MinMove 在PriceScale單位下,價格最小跳動數
報價的最小跳動點數 = MinMove / PriceScale
報價的最小跳動價值 = (MinMove / PriceScale) * BigPointValue