請教如何把下列指標模式的程式改為,警示模式的程式
variable: intrabarpersist position(0); // 目前position variable: intrabarpersist entry_price(0); // 最後一次進場的價格 //進場邏輯 // condition1 = close crosses above average(close, 20); // 出場邏輯 // condition2 = close crosses below average(close, 20); if position = 0 then begin if condition1 then begin position = 1; entry_price = close; print("(ENTRY) Date:", Date, " EntryPrice:", entry_price); plot1(low * 0.98, "entry"); end; end else begin if condition2 then begin position = 0; entry_price = 0; print("(EXIT) Date:", Date); plot2(high * 1.02, "exit"); end; end; Input: Period1(1); SetInputName(1, "EMA1");
1 評論