커뮤니티
문의드립니다.
2022-10-21 21:55:46
1251
글번호 163204
수고많으십니다.
1. 아래 답해주셨던 내용으로 돌려봤는데 수식에 오류가 있는지 작동하지 않았습니다. 수식상 오류가 없는지 바쁘시겠지만 전체적으로 한번 봐주시면 감사하겠습니다.
20봉 경과지점에서 5틱, 30봉 경과지점에서 10틱이내 변동성이면 무조건 전량 자동청산되는 식
if MarketPosition == 1 Then
{
if BarsSinceEntry == 20 and
highest(H,BarsSinceEntry) < EntryPrice+PriceScale*5 and
lowest(L,BarsSinceEntry) > EntryPrice+PriceScale*5 Then
ExitLong();
if BarsSinceEntry == 30 and
highest(H,BarsSinceEntry) < EntryPrice+PriceScale*10 and
lowest(L,BarsSinceEntry) > EntryPrice+PriceScale*10 Then
ExitLong();
}
if MarketPosition == 1 Then
{
if BarsSinceEntry == 20 and
highest(H,BarsSinceEntry) < EntryPrice+PriceScale*5 and
lowest(L,BarsSinceEntry) > EntryPrice+PriceScale*5 Then
ExitShort();
if BarsSinceEntry == 30 and
highest(H,BarsSinceEntry) < EntryPrice+PriceScale*10 and
lowest(L,BarsSinceEntry) > EntryPrice+PriceScale*10 Then
ExitShort();
}
-------------------------------------------------------------------------------
2. 1번과 비슷한 내용하지만 좀 다를 수 있는데
매수 진입한 후 N봉 갯수만큼 경과했는데 M틱 이상 상승하지 못했다면 M틱 이하 만큼 상승했던 아니면 하락했던 관계없이 무조건 전량 청산하는 식으로 부탁드립니다.
답변 1
예스스탁 예스스탁 답변
2022-10-24 09:53:16
안녕하세요
예스스탁입니다.
1
조건을 잘못 지정한 부분이 있어 식을 수정했습니다.
if MarketPosition == 1 Then
{
if BarsSinceEntry == 20 and
highest(H,BarsSinceEntry) < EntryPrice+PriceScale*5 and
lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*5 Then
ExitLong();
if BarsSinceEntry == 30 and
highest(H,BarsSinceEntry) < EntryPrice+PriceScale*10 and
lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*10 Then
ExitLong();
}
if MarketPosition == -1 Then
{
if BarsSinceEntry == 20 and
highest(H,BarsSinceEntry) < EntryPrice+PriceScale*5 and
lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*5 Then
ExitShort();
if BarsSinceEntry == 30 and
highest(H,BarsSinceEntry) < EntryPrice+PriceScale*10 and
lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*10 Then
ExitShort();
}
2
input : N(20),MM(0);
if MarketPosition == 1 Then
{
if BarsSinceEntry == N and
highest(H,BarsSinceEntry) < EntryPrice+PriceScale*MM Then
ExitLong();
}
if MarketPosition == -1 Then
{
if BarsSinceEntry == N and
lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*MM Then
ExitShort();
}
즐거운 하루되세요
> 카르마다 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 수고많으십니다.
1. 아래 답해주셨던 내용으로 돌려봤는데 수식에 오류가 있는지 작동하지 않았습니다. 수식상 오류가 없는지 바쁘시겠지만 전체적으로 한번 봐주시면 감사하겠습니다.
20봉 경과지점에서 5틱, 30봉 경과지점에서 10틱이내 변동성이면 무조건 전량 자동청산되는 식
if MarketPosition == 1 Then
{
if BarsSinceEntry == 20 and
highest(H,BarsSinceEntry) < EntryPrice+PriceScale*5 and
lowest(L,BarsSinceEntry) > EntryPrice+PriceScale*5 Then
ExitLong();
if BarsSinceEntry == 30 and
highest(H,BarsSinceEntry) < EntryPrice+PriceScale*10 and
lowest(L,BarsSinceEntry) > EntryPrice+PriceScale*10 Then
ExitLong();
}
if MarketPosition == 1 Then
{
if BarsSinceEntry == 20 and
highest(H,BarsSinceEntry) < EntryPrice+PriceScale*5 and
lowest(L,BarsSinceEntry) > EntryPrice+PriceScale*5 Then
ExitShort();
if BarsSinceEntry == 30 and
highest(H,BarsSinceEntry) < EntryPrice+PriceScale*10 and
lowest(L,BarsSinceEntry) > EntryPrice+PriceScale*10 Then
ExitShort();
}
-------------------------------------------------------------------------------
2. 1번과 비슷한 내용하지만 좀 다를 수 있는데
매수 진입한 후 N봉 갯수만큼 경과했는데 M틱 이상 상승하지 못했다면 M틱 이하 만큼 상승했던 아니면 하락했던 관계없이 무조건 전량 청산하는 식으로 부탁드립니다.
다음글
이전글