예스스탁
예스스탁 답변
2024-07-10 16:01:27
안녕하세요
예스스탁입니다.
1회발생의 기준이 모호해서 식 2개 작성해 드립니다.
1
전체 차트에서 각 라인에 1회만 발생하고자 하시면
아래식 이용하시면 됩니다.
input : B1(18600),B2(18500),B3(18400);
input : S1(18750),S2(18900),S3(19000);
var : Bcond1(False),Bcond2(False),Bcond3(False);
var : Scond1(False),Scond2(False),Scond3(False);
if Bcond1 == False Then
{
if L > B1 Then
Buy("b11",AtLimit,B1);
if H < B1 Then
Buy("b12",AtStop,B1);
}
if Bcond2 == False Then
{
if L > B2 Then
Buy("b21",AtLimit,B2);
if H < B2 Then
Buy("b22",AtStop,B2);
}
if Bcond3 == False Then
{
if L > B3 Then
Buy("b31",AtLimit,B3);
if H < B3 Then
Buy("b32",AtStop,B3);
}
if MarketPosition == 1 Then
{
if CurrentContracts > CurrentContracts[1] or MarketPosition != MarketPosition[1] Then
{
if LatestEntryName(0) == "b11" or LatestEntryName(0) == "b12" Then
Bcond1 = true;
if LatestEntryName(0) == "b21" or LatestEntryName(0) == "b22" Then
Bcond2 = true;
if LatestEntryName(0) == "b31" or LatestEntryName(0) == "b32" Then
Bcond3 = true;
}
}
if Scond1 == False Then
{
if H < S1 Then
Sell("s11",AtLimit,S1);
if L > S1 Then
Sell("s12",AtStop,S1);
}
if Scond2 == False Then
{
if H < S2 Then
Sell("s21",AtLimit,S2);
if L > S2 Then
Sell("s22",AtStop,S2);
}
if Scond3 == False Then
{
if H < S3 Then
Sell("s31",AtLimit,S3);
if L > S3 Then
Sell("s32",AtStop,S3);
}
if MarketPosition == -1 Then
{
if CurrentContracts > CurrentContracts[1] or MarketPosition != MarketPosition[1] Then
{
if LatestEntryName(0) == "s11" or LatestEntryName(0) == "s12" Then
Scond1 = true;
if LatestEntryName(0) == "s21" or LatestEntryName(0) == "s22" Then
Scond2 = true;
if LatestEntryName(0) == "s31" or LatestEntryName(0) == "s32" Then
Scond3 = true;
}
}
SetStopProfittarget(PriceScale*100,PointStop);
SetStopLoss(PriceScale*50,PointStop);
2
아래는 피라미딩의 경우 각 자리에서 한번만 발생하는 식입니다.
input : B1(18600),B2(18500),B3(18400);
input : S1(18750),S2(18900),S3(19000);
var : Bcond1(False),Bcond2(False),Bcond3(False);
var : Scond1(False),Scond2(False),Scond3(False);
if Bcond1 == False Then
{
if L > B1 Then
Buy("b11",AtLimit,B1);
if H < B1 Then
Buy("b12",AtStop,B1);
}
if Bcond2 == False Then
{
if L > B2 Then
Buy("b21",AtLimit,B2);
if H < B2 Then
Buy("b22",AtStop,B2);
}
if Bcond3 == False Then
{
if L > B3 Then
Buy("b31",AtLimit,B3);
if H < B3 Then
Buy("b32",AtStop,B3);
}
if MarketPosition == 1 Then
{
if CurrentContracts > CurrentContracts[1] or MarketPosition != MarketPosition[1] Then
{
if LatestEntryName(0) == "b11" or LatestEntryName(0) == "b12" Then
Bcond1 = true;
if LatestEntryName(0) == "b21" or LatestEntryName(0) == "b22" Then
Bcond2 = true;
if LatestEntryName(0) == "b31" or LatestEntryName(0) == "b32" Then
Bcond3 = true;
}
}
Else
{
Bcond1 = False;
Bcond2 = False;
Bcond3 = False;
}
if Scond1 == False Then
{
if H < S1 Then
Sell("s11",AtLimit,S1);
if L > S1 Then
Sell("s12",AtStop,S1);
}
if Scond2 == False Then
{
if H < S2 Then
Sell("s21",AtLimit,S2);
if L > S2 Then
Sell("s22",AtStop,S2);
}
if Scond3 == False Then
{
if H < S3 Then
Sell("s31",AtLimit,S3);
if L > S3 Then
Sell("s32",AtStop,S3);
}
if MarketPosition == -1 Then
{
if CurrentContracts > CurrentContracts[1] or MarketPosition != MarketPosition[1] Then
{
if LatestEntryName(0) == "s11" or LatestEntryName(0) == "s12" Then
Scond1 = true;
if LatestEntryName(0) == "s21" or LatestEntryName(0) == "s22" Then
Scond2 = true;
if LatestEntryName(0) == "s31" or LatestEntryName(0) == "s32" Then
Scond3 = true;
}
}
Else
{
Scond1 = False;
Scond2 = False;
Scond3 = False;
}
SetStopProfittarget(PriceScale*100,PointStop);
SetStopLoss(PriceScale*50,PointStop);
즐거운 하루되세요
> 다이버 님이 쓴 글입니다.
> 제목 : 지난번 질문에서 추가적인 질문드립니다.
> 안녕하세요? 지난번 아래와 같이 답변 주셔서 잘 사용하고 있는데요.
추가적인 질문사항이 있습니다.
아래의 경우, 18600, 18500, 18400 가격의 자리가 각각 올때마다
매수하고, 청산조건은 익절의 경우 100틱, 손절의 경우 50틱에 청산하는거였는데요.
각각의 자리에서 한번씩만 대응하도록 할 수 있을까요?
(예를 들어 18600의 자리가 한번 와서 익절이든 손절이든 청산되고 나면,
그 자리가 다시 오더라도 매수를 하지 않고,그 다음 매물대에 대응...)
매수자리와 매도자리 각 가격에서 한번씩만 대응할수 있도록 수식 부탁드립니다.
감사합니다.
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 다음과 같으 매물대에 매매하는 전략
>
안녕하세요
예스스탁입니다.
매물대 내용은 알수 없습니다.
가격 지정해서 신호 발생하게 작성해 드립니다.
input : B1(18600),B2(18500),B3(18400);
input : S1(18750),S2(18900),S3(19000);
var : BN(""),SN("");
if MarketPosition == 1 Then
{
BN = LatestExitName(0);
}
if MarketPosition == -1 Then
{
BN = LatestExitName(0);
}
if MarketPosition <= 0 Then
{
if BN != "b11" and BN != "b12" Then
{
if L > B1 Then
Buy("b11",AtLimit,B1);
if H < B1 Then
Buy("b12",AtStop,B1);
}
if BN != "b21" and BN != "b22" Then
{
if L > B2 Then
Buy("b21",AtLimit,B2);
if H < B2 Then
Buy("b22",AtStop,B2);
}
if BN != "b31" and BN != "b32" Then
{
if L > B3 Then
Buy("b31",AtLimit,B3);
if H < B3 Then
Buy("b32",AtStop,B3);
}
}
if MarketPosition >= 0 Then
{
if SN != "s11" and BN != "s12" Then
{
if H < S1 Then
Sell("s11",AtLimit,S1);
if L > S1 Then
Sell("s12",AtStop,S1);
}
if SN != "s21" and BN != "s22" Then
{
if H < S2 Then
Sell("s21",AtLimit,S2);
if L > S2 Then
Sell("s22",AtStop,S2);
}
if SN != "s31" and BN != "s32" Then
{
if H < S3 Then
Sell("s31",AtLimit,S3);
if L > S3 Then
Sell("s32",AtStop,S3);
}
}
SetStopProfittarget(PriceScale*100,PointStop);
SetStopLoss(PriceScale*50,PointStop);