예스스탁
예스스탁 답변
2020-07-22 15:02:59
안녕하세요
예스스탁입니다.
var : TL(0),str(""),TX(0);
var1 = ma(c,5) ;
var2 = ma(c,20) ;
if MarketPosition <= 0 and CrossUp(var1,var2) then
{
buy();
}
if MarketPosition >= 0 and CrossDown(var1,var2) then
{
sell();
}
if MarketPosition == 1 then
{
if PositionProfit(0) > 0 then
str = "수익 : "+NumToStr(abs(C-entryprice),2);
else
str = "손실 : "+NumToStr(abs(C-entryprice),2);
if BarsSinceEntry == 1 then
{
TL = TL_new(entrydate,entrytime,entryprice,sdate,stime,c);
TX = text_new(sdate,stime,C,str);
}
else
{
TL_setend(TL,sdate,stime,c);
text_setlocation(tx,sdate,stime,c);
Text_SetString(TX, str);
}
if PositionProfit(0) > 0 then
TL_setcolor(TL,red);
else
TL_setcolor(TL,blue);
}
if MarketPosition == -1 then
{
if PositionProfit(0) > 0 then
str = "수익 : "+NumToStr(abs(C-entryprice),2);
else
str = "손실 : "+NumToStr(abs(C-entryprice),2);
if BarsSinceEntry == 1 then
{
TL = TL_new(entrydate,entrytime,entryprice,sdate,stime,c);
TX = text_new(sdate,stime,C,str);
}
else
{
TL_setend(TL,sdate,stime,c);
text_setlocation(tx,sdate,stime,c);
Text_SetString(TX, str);
}
if PositionProfit(0) > 0 then
TL_setcolor(TL,red);
else
TL_setcolor(TL,blue);
}
즐거운 하루되세요
> 요타 님이 쓴 글입니다.
> 제목 : 동일 틱수 표시 요청 드립니다.
> * 전일 문의 드린 사항 입니다.
* 요청1 : <첨부 사진> 처럼 수익,손실이 틀리는데 맞출수는 없는지요?
→거래 종목 : 마이크로 S&P 500
* 요청2 : 청산 되면 TL, TX선 삭재좀 부탁 드립니다. (아무리 실습 해도 모르겠네요...-.-)
* 요청3 : <그림> 과 같이 매수 되어 목표수익 까지 오면 1차 "청산"표시만 하고
본전에 오면 매도 하는 청산 로직좀 부탁 드립니다.
즉 작은 수익이 되도 안팔고 계속 가지고 갈라고 합니다.
그러나 혹시 반대로 매수 가격 까지 오면 청산 입니다.
var : TL(0),str(""),TX(0);
var1 = ma(c,5) ;
var2 = ma(c,20) ;
if MarketPosition <= 0 and CrossUp(var1,var2) then
{
buy();
}
if MarketPosition >= 0 and CrossDown(var1,var2) then
{
sell();
}
if MarketPosition == 1 then
{
if C > entryprice then
str = "수익 : "+NumToStr(abs(C-entryprice)/PriceScale,0)+"틱";
else
str = "손실 : "+NumToStr(abs(C-entryprice)/PriceScale,0)+"틱";
if BarsSinceEntry == 1 then
{
TL = TL_new(entrydate,entrytime,entryprice,sdate,stime,c);
TX = text_new(sdate,stime,C,str);
}
else
{
TL_setend(TL,sdate,stime,c);
text_setlocation(tx,sdate,stime,c);
Text_SetString(TX, str);
}
if C > entryprice then
TL_setcolor(TL,red);
else
TL_setcolor(TL,blue);
}
if MarketPosition == -1 then
{
if C < entryprice then
str = "수익 : "+NumToStr(abs(C-entryprice)/PriceScale,0)+"틱";
else
str = "손실 : "+NumToStr(abs(C-entryprice)/PriceScale,0)+"틱";
if BarsSinceEntry == 1 then
{
TL = TL_new(entrydate,entrytime,entryprice,sdate,stime,c);
TX = text_new(sdate,stime,C,str);
}
else
{
TL_setend(TL,sdate,stime,c);
text_setlocation(tx,sdate,stime,c);
Text_SetString(TX, str);
}
if C < entryprice then
TL_setcolor(TL,red);
else
TL_setcolor(TL,blue);
}
* 매번 고맙 습니다. 수고하십시요.