最近看瞭許多書籍&許多的程式碼,產生瞭下面一些邏輯的疑惑
請一號客服大大解惑
邏輯問題(1)
if time>0900 and C>O then buy next bar at market
跟
if time>0900 then begin if C>O
then buy next bar at market
請問這兩程式碼結果有不一樣嗎?
邏輯問題(2)
MP>0 VS MP=1 // 為什麼有時候用>0 有時候用=1代表多倉在手?
MP<0 VS MP=-1//為什麼有時候用<0 有時候用=-1代表空倉在手?
不都一樣的意思嗎?
邏輯問題(3) 張忠林書中的一段程式碼 (P207頁)
var: mybuy(false), myshort(false);
if date<>date[1] then begin
mybuy=false;>>>為什麼特地要定義一次 mybuy = false??
myshort=false;>>>為什麼特地要定義一次 myshort = false??
end;
一開始在宣告的地方不就已經定義為false了嗎?
為什麼還要特別去定義??
為什麼特地要在程式碼當中寫出 if ...then mybuy = ture??
if opend(0) > highd(1) then mybuy =ture;
if opend(0) < low (1) then myshort =ture;
if MP=0
and time>0845
and time<=1115 then begin
if mybuy=ture then begin / /if mybuy 不就等於 if mybuy = ture 嗎?
buy next bar at opend(0)*1.005 stop;
為什麼不寫成 ?
mybuy = opend(0) > highd(1);
myshort = opend(0) < low (1);
and time<=1115
and mybuy //可以直接這樣撰寫嗎?有一定要用then begin if mybuy = true then begin buy嗎?
then buy next bar at opend(0)*1.005 stop;
為什麼特地要在程式碼當中寫出 if mybuy = ture then begin?
if mybuy 不就等於 if mybuy = ture 嗎?