커뮤니티
수식 좀 수정 부탁 드립니다.
2019-03-19 07:24:08
371
글번호 127174
* 수식좀 부탁 드립니다.
* 아래 수식에서 청산후 재매매가 안되는데 지도 좀 바랍니다.
손실 청산이 되었으면 청산후 재매매 "재매도1" 과 "재매도2"가 실행이 안됨니다.
수정 요청 드립니다.
######## 아래 수식
var1= ma(c,20);
var2= ma(c,60);
if CrossUp(var1,var2) then sell("매도");
if CrossDown(var1,var2) Then buy("매수");
################# 청산 로직 ####################################
## 1단계 청산
if MarketPosition == 1 and C >= EntryPrice+PriceScale*20 Then ExitLong("매수이익청산");
if MarketPosition == 1 and C <= EntryPrice-PriceScale*20 Then ExitLong("매수손해청산");
if MarketPosition == -1 and C > EntryPrice+PriceScale*20 Then ExitShort("매도손해청산");
if MarketPosition == -1 and C < EntryPrice-PriceScale*20 Then ExitShort("매도수익청산");
## 2단계 청산후 재매매
if MarketPosition == 0 and IsEntryName("매수손해청산",1) == true Then sell("재매도1");
if MarketPosition == 0 and IsEntryName("매도손해청산",1) == true Then sell("재매도2");
* 고맙습니다.
- 1. 재매도(0318).png (0.34 MB)
답변 1
예스스탁 예스스탁 답변
2019-03-19 13:38:24
안녕하세요
예스스탁입니다.
진입명은 IsEntryName, 청산명은 IsExitName입니다.
if MarketPosition == 0 and IsExitName("매수손해청산",1) == true Then sell("재매도1");
if MarketPosition == 0 and IsExitName("매도손해청산",1) == true Then sell("재매도2");
즐거운 하루되세요
> 요타 님이 쓴 글입니다.
> 제목 : 수식 좀 수정 부탁 드립니다.
> * 수식좀 부탁 드립니다.
* 아래 수식에서 청산후 재매매가 안되는데 지도 좀 바랍니다.
손실 청산이 되었으면 청산후 재매매 "재매도1" 과 "재매도2"가 실행이 안됨니다.
수정 요청 드립니다.
######## 아래 수식
var1= ma(c,20);
var2= ma(c,60);
if CrossUp(var1,var2) then sell("매도");
if CrossDown(var1,var2) Then buy("매수");
################# 청산 로직 ####################################
## 1단계 청산
if MarketPosition == 1 and C >= EntryPrice+PriceScale*20 Then ExitLong("매수이익청산");
if MarketPosition == 1 and C <= EntryPrice-PriceScale*20 Then ExitLong("매수손해청산");
if MarketPosition == -1 and C > EntryPrice+PriceScale*20 Then ExitShort("매도손해청산");
if MarketPosition == -1 and C < EntryPrice-PriceScale*20 Then ExitShort("매도수익청산");
## 2단계 청산후 재매매
if MarketPosition == 0 and IsEntryName("매수손해청산",1) == true Then sell("재매도1");
if MarketPosition == 0 and IsEntryName("매도손해청산",1) == true Then sell("재매도2");
* 고맙습니다.
다음글
이전글