2010年3月17日 星期三

絕對點數停損

http://www.nisan.us/modules/newbb/viewtopic.php?topic_id=5414&forum=15

Parameter: 停損(50);

Vars: El(0),Es(0);
if BarsSinceEntry(0) > 0 and CurrentContracts <= -1 then  
 Es = EntryPrice(0) + 停損
end if
if BarsSinceEntry(0) > 0 and CurrentContracts >= 1 then
 El = EntryPrice(0) - 停損
end if
IF BarsSinceEntry(0) > 0 AND LOW < El THEN
 IF OPEN < El THEN
  EXITLONG thsi bar AT OPEN OR HIGHER
  EXITLONG thsi bar AT OPEN OR LOWER
 ELSE
  EXITLONG thsi bar AT El OR HIGHER
  EXITLONG thsi bar AT ElOR LOWER
 END IF
END IF
IF BarsSinceEntry(0) > 0 AND HIGH > Es THEN
 IF OPEN > Es THEN
  EXITSHORT thsi bar AT OPEN OR HIGHER
  EXITSHORT thsi bar AT OPEN OR LOWER
 ELSE
  EXITSHORT thsi bar AT Es OR HIGHER
  EXITSHORT thsi bar AT Es OR LOWER
 END IF
END IF

KCA: 此停損方式用到 "this bar" ,對新初學者此方式暗藏危機,所以請對此程式碼邏輯有所了解者再予使用,否則將有可能發生嚴重損失!

沒有留言: