커뮤니티
파라볼릭 청산 수식 추가 부탁해요~~
2019-01-11 12:38:37
192
글번호 125171
아래 청산 수식에 추가로 넣을려고 하는데요...
아래 매수 청산 또는 파라볼릭이 매도로 전환신호시 매수 청산하는 수식을 첨가하고 싶어요..
매수 청산: (아래 기존 청산수식) or (파라볼릭 매도신호시 청산)
매도 청산: (저 아래 기존 매도 청산수식) or (파라볼릭 매수 신호시 청산)
제 의도는 아래 청산 수식 외 파라볼릭 매도신호시에도 매수청산이 될수 있게 하려구요...
부탁드려요~~
if MarketPosition == 1 then{
SetStopProfittarget(PriceScale*익절1, PointStop);
SetStopLoss(PriceScale*손절1, PointStop);
}
if MarketPosition == -1 then{
SetStopProfittarget(PriceScale*익절2, PointStop);
SetStopLoss(PriceScale*손절2, PointStop);
}
if MarketPosition == 1 Then
{
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*고점청산1 Then
ExitLong("최고점즉시청산1",AtLimit,EntryPrice+PriceScale*고점청산1);
Else
{
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*매수1차상승 Then
ExitLong("약손실청산1",AtStop,EntryPrice+PriceScale*본전1);
Else
ExitLong("손절1",AtStop,EntryPrice-PriceScale*매수손절);
}
}
===============================================================================
input : p1(2),p2(1),af(0.02), maxAF(0.2);
input : 익절1(50),익절2(40),손절1(50),손절2(50);
input : 매수1차상승(30),매도1차상승(30),매수손절(100),매도손절(100);
input : N1(1),N2(100);
Input :N3(25),N4(25),매수제한(0.25),매도제한(0.25);
Input :청산시간(060000);
Input :본전1(-25),본전2(-9);
Input :고점청산1(65),고점청산2(60);
var : cnt(0),sum1(0),sum2(0),avg1(0),avg2(0),avg3(0),T(0),mav2(0),mav3(0),value(0);
var : sum3(0),Tcond(false);
var1 = CSar(af,maxAF);
Var4 = highest(H,N3);
Var5 = lowest(L,N3);
var1 = CSar(af,maxAF);
Var6 = highest(H,N4);
Var7 = lowest(L,N4);
if DayClose(N2) > 0 Then
{
sum1 = 0;
sum2 = 0;
for cnt = 0 to N2-1
{
if cnt < N1 Then
sum1 = sum1 + DayClose(cnt);
if cnt < N2 Then
sum2 = sum2 + DayClose(cnt+1);
}
avg1 = sum1/N1;
avg2 = sum2/N2;
T = 0;
if avg1 >= avg2 Then
T = 1;
if avg1 < avg2 Then
T = -1;
if var1 > C Then
{
value1 = index;
value2 = C;
}
If var1 < C Then
{
value3 = index;
value4 = C;
}
#매수
if MarketPosition == 0 and
T == 1 and
index >= value1+P1 and
C > highest(H,P1)[1] and
C <= Var4-(Var4-Var5)*매수제한 and
C > value2 then
buy("매수",OnClose,def,1);
#매도
if MarketPosition == 0 and
T == -1 and
index >= value3+P2 and
C < Lowest(L,P2)[1] and
C >= Var7+(Var6-Var7)*매도제한 and
C < value4 then
Sell("매도",OnClose,def,1);
if MarketPosition == 1 then{
SetStopProfittarget(PriceScale*익절1, PointStop);
SetStopLoss(PriceScale*손절1, PointStop);
}
if MarketPosition == -1 then{
SetStopProfittarget(PriceScale*익절2, PointStop);
SetStopLoss(PriceScale*손절2, PointStop);
}
if MarketPosition == 1 Then
{
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*고점청산1 Then
ExitLong("최고점즉시청산1",AtLimit,EntryPrice+PriceScale*고점청산1);
Else
{
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*매수1차상승 Then
ExitLong("약손실청산1",AtStop,EntryPrice+PriceScale*본전1);
Else
ExitLong("손절1",AtStop,EntryPrice-PriceScale*매수손절);
}
}
if MarketPosition == -1 Then
{
If Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*고점청산2 Then
ExitShort("최고점즉시청산2",AtStop,EntryPrice+PriceScale*고점청산2);
Else
{
if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*매도1차상승 Then
ExitShort("약손실청산2",AtStop,EntryPrice-PriceScale*본전2);
Else
ExitShort("손절2",AtStop,EntryPrice+PriceScale*매도손절);
}
}
}
if stime == 060000 Then{
exitlong("당일청산1");
ExitShort("당일청산2");
}
if MarketPosition == 1 Then
{
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*최고점바로청산1 Then
ExitLong("최고점즉시청산1",AtLimit,EntryPrice+PriceScale*최고점바로청산1);
Else
{
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*매수후수익날랑말랑한틱수 Then
ExitLong("약손실청산1",AtStop,EntryPrice+PriceScale*본전틱수1);
Else
ExitLong("가슴아픈손절1",AtStop,EntryPrice-PriceScale*매수진입후아예빠져서손절날틱수);
}
}
if MarketPosition == -1 Then
{
If Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*최고점바로청산2 Then
ExitShort("최고점즉시청산2",AtStop,EntryPrice+PriceScale*최고점바로청산2);
Else
{
if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*매도후수익날랑말랑한틱수 Then
ExitShort("약손실청산2",AtStop,EntryPrice-PriceScale*본전틱수2);
Else
ExitShort("가슴찢어지는손절",AtStop,EntryPrice+PriceScale*매도진입한후아예빠져서손절날틱수);
}
}
}
if stime == 청산시간 Then{
exitlong("당일청산1");
ExitShort("당일청산2");
}
답변 1
예스스탁 예스스탁 답변
2019-01-11 14:48:52
안녕하세요
예스스탁입니다.
올려주신 수식이 문법검증이 되지 않아 어느부분에 추가해 드려야 할지 모르겠습니다.
작성하신 시스템에서 var1이 파라볼릭입니다.
사용하는 수식 하단에 아래 내용 추가하시면 됩니다.
if MarketPosition == 1 Then
{
if CrossDown(c,var1) Then
exitlong();
}
if MarketPosition == -1 Then
{
if Crossup(c,var1) Then
ExitShort();
}
즐거운 하루되세요
> 이형지 님이 쓴 글입니다.
> 제목 : 파라볼릭 청산 수식 추가 부탁해요~~
> 아래 청산 수식에 추가로 넣을려고 하는데요...
아래 매수 청산 또는 파라볼릭이 매도로 전환신호시 매수 청산하는 수식을 첨가하고 싶어요..
매수 청산: (아래 기존 청산수식) or (파라볼릭 매도신호시 청산)
매도 청산: (저 아래 기존 매도 청산수식) or (파라볼릭 매수 신호시 청산)
제 의도는 아래 청산 수식 외 파라볼릭 매도신호시에도 매수청산이 될수 있게 하려구요...
부탁드려요~~
if MarketPosition == 1 then{
SetStopProfittarget(PriceScale*익절1, PointStop);
SetStopLoss(PriceScale*손절1, PointStop);
}
if MarketPosition == -1 then{
SetStopProfittarget(PriceScale*익절2, PointStop);
SetStopLoss(PriceScale*손절2, PointStop);
}
if MarketPosition == 1 Then
{
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*고점청산1 Then
ExitLong("최고점즉시청산1",AtLimit,EntryPrice+PriceScale*고점청산1);
Else
{
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*매수1차상승 Then
ExitLong("약손실청산1",AtStop,EntryPrice+PriceScale*본전1);
Else
ExitLong("손절1",AtStop,EntryPrice-PriceScale*매수손절);
}
}
===============================================================================
input : p1(2),p2(1),af(0.02), maxAF(0.2);
input : 익절1(50),익절2(40),손절1(50),손절2(50);
input : 매수1차상승(30),매도1차상승(30),매수손절(100),매도손절(100);
input : N1(1),N2(100);
Input :N3(25),N4(25),매수제한(0.25),매도제한(0.25);
Input :청산시간(060000);
Input :본전1(-25),본전2(-9);
Input :고점청산1(65),고점청산2(60);
var : cnt(0),sum1(0),sum2(0),avg1(0),avg2(0),avg3(0),T(0),mav2(0),mav3(0),value(0);
var : sum3(0),Tcond(false);
var1 = CSar(af,maxAF);
Var4 = highest(H,N3);
Var5 = lowest(L,N3);
var1 = CSar(af,maxAF);
Var6 = highest(H,N4);
Var7 = lowest(L,N4);
if DayClose(N2) > 0 Then
{
sum1 = 0;
sum2 = 0;
for cnt = 0 to N2-1
{
if cnt < N1 Then
sum1 = sum1 + DayClose(cnt);
if cnt < N2 Then
sum2 = sum2 + DayClose(cnt+1);
}
avg1 = sum1/N1;
avg2 = sum2/N2;
T = 0;
if avg1 >= avg2 Then
T = 1;
if avg1 < avg2 Then
T = -1;
if var1 > C Then
{
value1 = index;
value2 = C;
}
If var1 < C Then
{
value3 = index;
value4 = C;
}
#매수
if MarketPosition == 0 and
T == 1 and
index >= value1+P1 and
C > highest(H,P1)[1] and
C <= Var4-(Var4-Var5)*매수제한 and
C > value2 then
buy("매수",OnClose,def,1);
#매도
if MarketPosition == 0 and
T == -1 and
index >= value3+P2 and
C < Lowest(L,P2)[1] and
C >= Var7+(Var6-Var7)*매도제한 and
C < value4 then
Sell("매도",OnClose,def,1);
if MarketPosition == 1 then{
SetStopProfittarget(PriceScale*익절1, PointStop);
SetStopLoss(PriceScale*손절1, PointStop);
}
if MarketPosition == -1 then{
SetStopProfittarget(PriceScale*익절2, PointStop);
SetStopLoss(PriceScale*손절2, PointStop);
}
if MarketPosition == 1 Then
{
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*고점청산1 Then
ExitLong("최고점즉시청산1",AtLimit,EntryPrice+PriceScale*고점청산1);
Else
{
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*매수1차상승 Then
ExitLong("약손실청산1",AtStop,EntryPrice+PriceScale*본전1);
Else
ExitLong("손절1",AtStop,EntryPrice-PriceScale*매수손절);
}
}
if MarketPosition == -1 Then
{
If Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*고점청산2 Then
ExitShort("최고점즉시청산2",AtStop,EntryPrice+PriceScale*고점청산2);
Else
{
if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*매도1차상승 Then
ExitShort("약손실청산2",AtStop,EntryPrice-PriceScale*본전2);
Else
ExitShort("손절2",AtStop,EntryPrice+PriceScale*매도손절);
}
}
}
if stime == 060000 Then{
exitlong("당일청산1");
ExitShort("당일청산2");
}
if MarketPosition == 1 Then
{
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*최고점바로청산1 Then
ExitLong("최고점즉시청산1",AtLimit,EntryPrice+PriceScale*최고점바로청산1);
Else
{
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*매수후수익날랑말랑한틱수 Then
ExitLong("약손실청산1",AtStop,EntryPrice+PriceScale*본전틱수1);
Else
ExitLong("가슴아픈손절1",AtStop,EntryPrice-PriceScale*매수진입후아예빠져서손절날틱수);
}
}
if MarketPosition == -1 Then
{
If Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*최고점바로청산2 Then
ExitShort("최고점즉시청산2",AtStop,EntryPrice+PriceScale*최고점바로청산2);
Else
{
if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*매도후수익날랑말랑한틱수 Then
ExitShort("약손실청산2",AtStop,EntryPrice-PriceScale*본전틱수2);
Else
ExitShort("가슴찢어지는손절",AtStop,EntryPrice+PriceScale*매도진입한후아예빠져서손절날틱수);
}
}
}
if stime == 청산시간 Then{
exitlong("당일청산1");
ExitShort("당일청산2");
}
이전글