커뮤니티
문의드립니다
안녕하세요 ?
아래수식이 에러가 있는데 도움주세요
감사드립니다
Inputs:
length(5),
FilterBars(2);
Vars:
lastHiVal_1m(0), lastLoVal_1m(0),
sig1_Buy(False), sig1_Sell(False),
last1mBuyBar(0), last1mSellBar(0),
xOpen_1m(0), xClose_1m(0),
Condition1_1m(False), Condition2_1m(False),
lastHiVal_2m(0), lastLoVal_2m(0),
sig2_Buy(False), sig2_Sell(False),
xOpen_2m(0), xClose_2m(0),
Condition1_2m(False), Condition2_2m(False),
barCount(0),
LastAlertBar(0),
FilterBuyCond(False),
FilterSellCond(False);
sig1_Buy = False;
sig1_Sell = False;
Condition1_1m = (High = Highest(High, length)) and (lastHiVal_1m <> High);
Condition2_1m = (Low = Lowest(Low, length)) and (lastLoVal_1m <> Low);
If Condition1_1m Then Begin
lastHiVal_1m = High;
End;
If Condition2_1m Then Begin
lastLoVal_1m = Low;
End;
If xOpen_1m = 0 Then Begin
xOpen_1m = Open;
End;
xClose_1m = (Open + High + Low + Close) / 4;
xOpen_1m = (xOpen_1m + xClose_1m) / 2;
If (xOpen_1m <> xOpen_1m) or (xClose_1m <> xClose_1m) Then Begin
xOpen_1m = Open;
xClose_1m = Close;
End;
If Condition2_1m and (xClose_1m > xOpen_1m) Then Begin
sig1_Buy = True;
last1mBuyBar = CurrentBar;
End;
If Condition1_1m and (xClose_1m < xOpen_1m) Then Begin
sig1_Sell = True;
last1mSellBar = CurrentBar;
End;
barCount = barCount + 1;
If barCount >= 2 Then Begin
Condition1_2m = (High = Highest(High, length)) and (lastHiVal_2m <> High);
Condition2_2m = (Low = Lowest(Low, length)) and (lastLoVal_2m <> Low);
If Condition1_2m Then Begin
lastHiVal_2m = High;
End;
If Condition2_2m Then Begin
lastLoVal_2m = Low;
End;
If xOpen_2m = 0 Then Begin
xOpen_2m = Open;
End;
xClose_2m = (Open + High + Low + Close) / 4;
xOpen_2m = (xOpen_2m + xClose_2m) / 2;
If (xOpen_2m <> xOpen_2m) or (xClose_2m <> xClose_2m) Then Begin
xOpen_2m = Open;
xClose_2m = Close;
End;
sig2_Buy = Condition2_2m and (xClose_2m > xOpen_2m);
sig2_Sell = Condition1_2m and (xClose_2m < xOpen_2m);
barCount = 0;
End;
FilterBuyCond = (CurrentBar - last1mBuyBar) <= FilterBars;
FilterSellCond = (CurrentBar - last1mSellBar) <= FilterBars;
If sig2_Buy and FilterBuyCond Then Begin
If LastAlertBar <> CurrentBar Then Begin
Buy Next Bar at Market;
LastAlertBar = CurrentBar;
End;
End;
If sig2_Sell and FilterSellCond Then Begin
If LastAlertBar <> CurrentBar Then Begin
Sell Short Next Bar at Market;
LastAlertBar = CurrentBar;
End;
End;
답변 1
예스스탁 예스스탁 답변
2025-11-03 16:29:23