예스스탁
예스스탁 답변
2023-11-29 14:54:38
안녕하세요
예스스탁입니다.
변수 ll에 저장되게 작성해 드립니다.
input : P(20),dv(2);
var : bbup(0),bbmd(0),bbdn(0),ll(0);
bbup = BollBandUp(P,dv);
bbmd = ma(C,P);
bbdn = BollBandDown(P,dv);
if MarketPosition == 0 and L[1] <= BBdn and H[1] > BBdn and C > C[1] and C > BBdn Then
{
ll = lowest(l,2);
Buy("b",OnClose,Def,4);
ExitLong("bp",AtLimit,C+PriceScale*20);
ExitLong("bl",AtStop,L);
}
if MarketPosition == 1 Then
{
ExitLong("Bp1",AtLimit,EntryPrice+PriceScale*20,"",2,1);
ExitLong("Bp2",AtLimit,BBup);
if CurrentContracts == MaxContracts Then
ExitLong("bl1",AtStop,L[BarsSinceEntry]);
Else
ExitLong("bl2",AtStop,EntryPrice);
}
if MarketPosition == 0 and L[1] <= BBup and H[1] > BBup and C < C[1] and C < BBup Then
{
Sell("s",OnClose,Def,4);
ExitShort("sp",AtLimit,C-PriceScale*20);
ExitShort("sl",AtStop,H);
}
if MarketPosition == -1 Then
{
ExitShort("sp1",AtLimit,EntryPrice-PriceScale*20,"",2,1);
ExitShort("sp2",AtLimit,BBdn);
if CurrentContracts == MaxContracts Then
ExitShort("sl1",AtStop,H[BarsSinceEntry]);
Else
ExitShort("sl2",AtStop,EntryPrice);
}
즐거운 하루되세요
> 종호 님이 쓴 글입니다.
> 제목 : 문의드립니다.
>
아래수식에서
무포지션에서 매수를 할 때의 매수봉의 저가와 매수봉 바로 직전봉의 저가를 비교해서
2개 저가중 작은 값을 변수 c를 새로 추가하여
저장하려고 합니다.
변수 c 에 저장하는 수식을 부탁드립니다.
input : P(20),dv(2);
var : bbup(0),bbmd(0),bbdn(0);
bbup = BollBandUp(P,dv);
bbmd = ma(C,P);
bbdn = BollBandDown(P,dv);
if MarketPosition == 0 and L[1] <= BBdn and H[1] > BBdn and C > C[1] and C > BBdn Then
{
Buy("b",OnClose,Def,4);
ExitLong("bp",AtLimit,C+PriceScale*20);
ExitLong("bl",AtStop,L);
}
if MarketPosition == 1 Then
{
ExitLong("Bp1",AtLimit,EntryPrice+PriceScale*20,"",2,1);
ExitLong("Bp2",AtLimit,BBup);
if CurrentContracts == MaxContracts Then
ExitLong("bl1",AtStop,L[BarsSinceEntry]);
Else
ExitLong("bl2",AtStop,EntryPrice);
}
if MarketPosition == 0 and L[1] <= BBup and H[1] > BBup and C < C[1] and C < BBup Then
{
Sell("s",OnClose,Def,4);
ExitShort("sp",AtLimit,C-PriceScale*20);
ExitShort("sl",AtStop,H);
}
if MarketPosition == -1 Then
{
ExitShort("sp1",AtLimit,EntryPrice-PriceScale*20,"",2,1);
ExitShort("sp2",AtLimit,BBdn);
if CurrentContracts == MaxContracts Then
ExitShort("sl1",AtStop,H[BarsSinceEntry]);
Else
ExitShort("sl2",AtStop,EntryPrice);
}