你好 我目前是這樣設定的@@
variable: intrabarpersist position(0); // 目前position
variable: intrabarpersist entry_price(0); // 最後一次進場的價格
input: Length1(6), Length2(12);
SetInputName(1, "天數一");
SetInputName(2, "天數二");
//進場邏輯
//
condition1 = RSI(Close, Length1)>50.0000 and RSI(Close, Length2)>50.0000 and close crosses above average(close, 10);
// 出場邏輯
//
condition2 = RSI(Close, Length1)<50.0000 and RSI(Close, Length2)<50.0000 and close crosses below average(close, 10);
if position = 0 then
begin
if condition1 then
begin
position = 1;
entry_price = close;
print("(ENTRY) Date:", Date, " EntryPrice:", entry_price);
plot1(low , "ENTRY");
end;
end
else
begin
if condition2 then
begin
position = 0;
entry_price = 0;
print("(EXIT) Date:", Date);
plot2(low , "EXIT");
end;
end;
9 評論