안녕하세요
아래수식은 작동을 합니다.
그런데요
청산후 A가격이 변동되어 적용된 후에
한쪽 방향으로 계속 가면 CrossUp이나 CrossDown 이 동작하지 않습니다.
수정 가능할까요?
input : 시작날짜(20220124),시작시간(90000);
input : A(380);
var : Tcond(False),Price(0);
if Tcond == false and sDate >= 시작날짜 and sTime >= 시작시간 Then
{
Tcond = true;
price = A;
}
if Tcond == true Then
{
if TotalTrades > TotalTrades[1] and IsExitName("StopProfitTarget",1) == true Then
{
if MarketPosition(1) == 1 Then
Price = Price + PriceScale*30;
if MarketPosition(1) == -1 Then
Price = Price - PriceScale*30;
}
if MarketPosition <= 0 and CrossUp(C,Price+PriceScale*10) Then
Buy("b");
if MarketPosition >= 0 and CrossDown(C,price-PriceScale*10) Then
Sell("s");
}
SetStopProfittarget(PriceScale*30,PointStop);
즐거운 하루되세요
> 종호 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 안녕하세요
아래 수식에서
매매후 이익이 나면 input A 를
변경하고 싶습니다.
예를 들어
매수시 30틱 이익시 A를 A+30틱 으로
매도시 30틱 이익시 A를 A-30틱으로 변경되도록 부탁드립니다,
그리고 청산과 동시에 반대방향으로 진입이 이루어질 때 증가금이 2배로 잡히므로
2배 증거금 안잡히도록 매매하고 싶은데 어떻게 하면 좋겠습니까?
방법을 같이 부탁드립니다.
input : 시작날짜(20220124),시작시간(90000);
input : A(380);
var : Tcond(False);
if Tcond == false and sDate >= 시작날짜 and sTime >= 시작시간 Then
Tcond = true;
if Tcond == true Then
{
if MarketPosition <= 0 and CrossUp(C,A+PriceScale*10) Then
Buy("b");
if MarketPosition >= 0 and CrossDown(C,A-PriceScale*10) Then
Sell("s");
}
답변 1
예스스탁
예스스탁 답변
2022-01-26 16:36:36
안녕하세요
예스스탁입니다.
현재 30틱 수익후에
A값이 +-30틱으로 변경되는데 종가는 이미 해당 가격을 초과하면
crossup,crossdown조건이 성립이 되지 않습니다.
C >= Price+PriceScale*10는 매수
C <= Price-PriceScale*10는 매도
돌파로는 방법이 없고 단순 크다/작다 비교로 진입하게 수정해 드립니다.
input : 시작날짜(20220124),시작시간(90000);
input : A(380);
var : Tcond(False),Price(0);
if Tcond == false and sDate >= 시작날짜 and sTime >= 시작시간 Then
{
Tcond = true;
price = A;
}
if Tcond == true Then
{
if TotalTrades > TotalTrades[1] and IsExitName("StopProfitTarget",1) == true Then
{
if MarketPosition(1) == 1 Then
Price = Price + PriceScale*30;
if MarketPosition(1) == -1 Then
Price = Price - PriceScale*30;
}
MessageLog("%.2f %.2f %.2f",C,Price-PriceScale*10);
if MarketPosition <= 0 and C >= Price+PriceScale*10 Then
Buy("b");
if MarketPosition >= 0 and C <= price-PriceScale*10 Then
Sell("s");
}
SetStopProfittarget(PriceScale*30,PointStop);
즐거운 하루되세요
> 종호 님이 쓴 글입니다.
> 제목 : 재문의드립니다.
> 안녕하세요
아래수식은 작동을 합니다.
그런데요
청산후 A가격이 변동되어 적용된 후에
한쪽 방향으로 계속 가면 CrossUp이나 CrossDown 이 동작하지 않습니다.
수정 가능할까요?
input : 시작날짜(20220124),시작시간(90000);
input : A(380);
var : Tcond(False),Price(0);
if Tcond == false and sDate >= 시작날짜 and sTime >= 시작시간 Then
{
Tcond = true;
price = A;
}
if Tcond == true Then
{
if TotalTrades > TotalTrades[1] and IsExitName("StopProfitTarget",1) == true Then
{
if MarketPosition(1) == 1 Then
Price = Price + PriceScale*30;
if MarketPosition(1) == -1 Then
Price = Price - PriceScale*30;
}
if MarketPosition <= 0 and CrossUp(C,Price+PriceScale*10) Then
Buy("b");
if MarketPosition >= 0 and CrossDown(C,price-PriceScale*10) Then
Sell("s");
}
SetStopProfittarget(PriceScale*30,PointStop);
즐거운 하루되세요
> 종호 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 안녕하세요
아래 수식에서
매매후 이익이 나면 input A 를
변경하고 싶습니다.
예를 들어
매수시 30틱 이익시 A를 A+30틱 으로
매도시 30틱 이익시 A를 A-30틱으로 변경되도록 부탁드립니다,
그리고 청산과 동시에 반대방향으로 진입이 이루어질 때 증가금이 2배로 잡히므로
2배 증거금 안잡히도록 매매하고 싶은데 어떻게 하면 좋겠습니까?
방법을 같이 부탁드립니다.
input : 시작날짜(20220124),시작시간(90000);
input : A(380);
var : Tcond(False);
if Tcond == false and sDate >= 시작날짜 and sTime >= 시작시간 Then
Tcond = true;
if Tcond == true Then
{
if MarketPosition <= 0 and CrossUp(C,A+PriceScale*10) Then
Buy("b");
if MarketPosition >= 0 and CrossDown(C,A-PriceScale*10) Then
Sell("s");
}