顯示具有 this bar 標籤的文章。 顯示所有文章
顯示具有 this bar 標籤的文章。 顯示所有文章

2010年3月19日 星期五

無 bug 的 this bar

variables : mkp(0)

If mkp = 0 then 
 if XXXX > low then 
  sell this bar at XXXX or higher 
  sell this bar at XXXX or lower 
 else if YYYY < high then
    buy this bar at YYYY or higher
    buy this bar at YYYY or lower
 end if
end if


If mkp = 1 then
 if XXXX > low then 
  sell this bar at XXXX or higher 
  sell this bar at XXXX or lower 
 end if 
end if 

If mkp = -1 then
 if YYYY < high then
  buy this bar at YYYY or higher
  buy this bar at YYYY or lower
 end if
end if
mkp = marketposition

2010年1月25日 星期一

停損在 this bar

有個指令可以讓你使用停損在 this bar,那就是 BarsSinceEntry,

0為進場點,進場點為第一根,大於零表示從進場後第二根起算。

例子:
IF Close < EntryPrice(0)-10 AND BarsSinceEntry(0) > 0 THEN
 ExitLong this bar at market
END IF