커뮤니티
문의
2013-07-16 10:16:04
209
글번호 65379
피봇 이차선으로 매매하는 식에서 stop trailing을 0.7/0.6으로 걸어놓고
20봉 동안 0.7 이상 수익이 없으면 목표가를 0.5로 정하고 청산하는 식인데
틀린것 같아서요 확인 부탁드립니다
input : pivot_idx(22), pivot_CH(0.3),stopPoint(1.6);
Var : PP(0), PR1(0), PR2(0), PS1(0), PS2(0);
setstoploss(stopPoint, pointstop);
if dayindex() <= pivot_idx then {
if C > PR2 and bids > asks then
buy("PP_B");
if C < pS2 and bids < asks then
sell("PP_S");
}
if isEntryname("PP_B") and CrossDown(C, PR2-pivot_CH) then
exitlong("PP_ES");
if isEntryname("PP_S") and CrossUp(C, PS2+pivot_CH) then
exitshort("PP_EL");
var : Bcond(false),Scond(false);
if MarketPosition == 1 Then{
if MaxPositionProfit >= 0.8 and BarsSinceEntry <= 20 Then
Bcond = true;
if BarsSinceEntry > 20 and Bcond == false Then
exitlong("bx",atlimit,EntryPrice+0.5);
}
Else
Bcond = false;
if MarketPosition == -1 Then{
if MaxPositionProfit >= 0.8 and BarsSinceEntry <= 20 Then
Scond = true;
if BarsSinceEntry > 20 and Scond == false Then
ExitShort("sx",atlimit,EntryPrice-0.5);
}
Else
Scond = false;
답변 1
예스스탁 예스스탁 답변
2013-07-16 15:41:44
안녕하세요
예스스탁입니다.
기존작성된 식이 0.8이상의 수익이 발생되지 않아야 동작되게 되어 있었습니다.
0.7이상 수익이 발생되지 않은 경우로 수정했습니다.
input : pivot_idx(22), pivot_CH(0.3),stopPoint(1.6);
Var : PP(0), PR1(0), PR2(0), PS1(0), PS2(0);
var : Bcond(false),Scond(false);
setstoploss(stopPoint, pointstop);
if dayindex() <= pivot_idx then {
if C > PR2 and bids > asks then
buy("PP_B");
if C < pS2 and bids < asks then
sell("PP_S");
}
if isEntryname("PP_B") and CrossDown(C, PR2-pivot_CH) then
exitlong("PP_ES");
if isEntryname("PP_S") and CrossUp(C, PS2+pivot_CH) then
exitshort("PP_EL");
if MarketPosition == 1 Then{
if MaxPositionProfit >= 0.7 and BarsSinceEntry <= 20 Then
Bcond = true;
if BarsSinceEntry > 20 and Bcond == false Then
exitlong("bx",atlimit,EntryPrice+0.5);
}
Else
Bcond = false;
if MarketPosition == -1 Then{
if MaxPositionProfit >= 0.7 and BarsSinceEntry <= 20 Then
Scond = true;
if BarsSinceEntry > 20 and Scond == false Then
ExitShort("sx",atlimit,EntryPrice-0.5);
}
Else
Scond = false;
수식에서 사용하시는 MaxPositionProfit함수는
시스템 트레이딩 설정창의 비용/수량탭에서 지정한
수수료와 슬리피지가 포함된 손익을 리턴합니다.
만약 수수료와 슬리피지를 제외하고
보고자 하시면 해당 값을 모두 0으로 셋팅하시면 됩니다.
즐거운 하루되세요
> 구다이전설 님이 쓴 글입니다.
> 제목 : 문의
>
피봇 이차선으로 매매하는 식에서 stop trailing을 0.7/0.6으로 걸어놓고
20봉 동안 0.7 이상 수익이 없으면 목표가를 0.5로 정하고 청산하는 식인데
틀린것 같아서요 확인 부탁드립니다
input : pivot_idx(22), pivot_CH(0.3),stopPoint(1.6);
Var : PP(0), PR1(0), PR2(0), PS1(0), PS2(0);
setstoploss(stopPoint, pointstop);
if dayindex() <= pivot_idx then {
if C > PR2 and bids > asks then
buy("PP_B");
if C < pS2 and bids < asks then
sell("PP_S");
}
if isEntryname("PP_B") and CrossDown(C, PR2-pivot_CH) then
exitlong("PP_ES");
if isEntryname("PP_S") and CrossUp(C, PS2+pivot_CH) then
exitshort("PP_EL");
var : Bcond(false),Scond(false);
if MarketPosition == 1 Then{
if MaxPositionProfit >= 0.8 and BarsSinceEntry <= 20 Then
Bcond = true;
if BarsSinceEntry > 20 and Bcond == false Then
exitlong("bx",atlimit,EntryPrice+0.5);
}
Else
Bcond = false;
if MarketPosition == -1 Then{
if MaxPositionProfit >= 0.8 and BarsSinceEntry <= 20 Then
Scond = true;
if BarsSinceEntry > 20 and Scond == false Then
ExitShort("sx",atlimit,EntryPrice-0.5);
}
Else
Scond = false;
다음글
이전글