예스스탁
예스스탁 답변
2025-03-12 13:49:03
안녕하세요
예스스탁입니다.
input : n(5);
input : cc(5), sm(4), lm(11);
var1 = ma(c,cc);
var2 = ma(c,sm);
var3 = ma(c,lm);
Condition1 = var1 < Var3 and Var2 > Var3;
Condition2 = var1 > Var3 and Var2 < var3;
if NextBarSdate != sDate Then
{
if DayClose(1) < DayOpen(1) and DayClose(0) > DayOpen(0) Then
{
if max(DayClose(1),DayOpen(1)) > max(DayClose(0),DayOpen(0)) and
min(DayClose(1),DayOpen(1)) < min(DayClose(0),DayOpen(0)) and
condition2 == true
Then
Sell("s1",AtMarket);
if max(DayClose(1),DayOpen(1)) < max(DayClose(0),DayOpen(0)) and
min(DayClose(1),DayOpen(1)) > min(DayClose(0),DayOpen(0)) and
condition2 == true then
Sell("s2",AtMarket);
}
if DayClose(1) > DayOpen(1) and DayClose(0) < DayOpen(0) Then
{
if max(DayClose(1),DayOpen(1)) > max(DayClose(0),DayOpen(0)) and
min(DayClose(1),DayOpen(1)) < min(DayClose(0),DayOpen(0)) and
condition1 == true Then
Buy("b1",AtMarket);
if max(DayClose(1),DayOpen(1)) < max(DayClose(0),DayOpen(0)) and
min(DayClose(1),DayOpen(1)) > min(DayClose(0),DayOpen(0))and
condition1 == true Then
Buy("b2",AtMarket);
}
}
if MarketPosition == -1 Then
{
if IsEntryName("s1",0) == true and BarsSinceEntry == n Then
{
if NextBarOpen >= EntryPrice Then
ExitShort("sx1",AtMarket);
Else
Buy("b3",AtMarket);
}
if IsEntryName("s2",0) == true and BarsSinceEntry == n Then
{
if NextBarOpen >= EntryPrice Then
ExitShort("sx2",AtMarket);
Else
Buy("b4",AtMarket);
}
if IsEntryName("s3",0) == true and BarsSinceEntry == n Then
{
ExitShort("sx3",AtMarket);
}
if IsEntryName("s4",0) == true and BarsSinceEntry == n Then
{
ExitShort("sx4",AtMarket);
}
}
if MarketPosition == 1 Then
{
if IsEntryName("b1",0) == true and BarsSinceEntry == n Then
{
if NextBarOpen <= EntryPrice Then
ExitLong("bx1",AtMarket);
Else
Sell("s3",AtMarket);
}
if IsEntryName("b2",0) == true and BarsSinceEntry == n Then
{
if NextBarOpen <= EntryPrice Then
ExitLong("bx2",AtMarket);
Else
Sell("s4",AtMarket);
}
if IsEntryName("b3",0) == true and BarsSinceEntry == n Then
{
ExitLong("bx3",AtMarket);
}
if IsEntryName("b4",0) == true and BarsSinceEntry == n Then
{
ExitLong("bx4",AtMarket);
}
}
즐거운 하루되세요
> 흰둥이아빠 님이 쓴 글입니다.
> 제목 : 함수요청
> 안녕하세요?
아래 스크립트에서 매수신호는 매도신호를 매도신호는 매수신호를
매수청산신호는 매도청산신호를 매도청산신호는 매수청산신호가 생성되도록 신호를 거꾸로 나오게 해주세요
input : n(5);
input : cc(5), sm(4), lm(11);
var1 = ma(c,cc);
var2 = ma(c,sm);
var3 = ma(c,lm);
Condition1 = var1 < Var3 and Var2 > Var3;
Condition2 = var1 > Var3 and Var2 < var3;
if NextBarSdate != sDate Then
{
if DayClose(1) < DayOpen(1) and DayClose(0) > DayOpen(0) Then
{
if max(DayClose(1),DayOpen(1)) > max(DayClose(0),DayOpen(0)) and
min(DayClose(1),DayOpen(1)) < min(DayClose(0),DayOpen(0)) and
condition2 == true
Then
Buy("b1",AtMarket);
if max(DayClose(1),DayOpen(1)) < max(DayClose(0),DayOpen(0)) and
min(DayClose(1),DayOpen(1)) > min(DayClose(0),DayOpen(0)) and
condition2 == true then
Buy("b2",AtMarket);
}
if DayClose(1) > DayOpen(1) and DayClose(0) < DayOpen(0) Then
{
if max(DayClose(1),DayOpen(1)) > max(DayClose(0),DayOpen(0)) and
min(DayClose(1),DayOpen(1)) < min(DayClose(0),DayOpen(0)) and
condition1 == true Then
Sell("s1",AtMarket);
if max(DayClose(1),DayOpen(1)) < max(DayClose(0),DayOpen(0)) and
min(DayClose(1),DayOpen(1)) > min(DayClose(0),DayOpen(0))and
condition1 == true Then
Sell("s2",AtMarket);
}
}
if MarketPosition == 1 Then
{
if IsEntryName("b1",0) == true and BarsSinceEntry == n Then
{
if NextBarOpen >= EntryPrice Then
ExitLong("bx1",AtMarket);
Else
Sell("s3",AtMarket);
}
if IsEntryName("b2",0) == true and BarsSinceEntry == n Then
{
if NextBarOpen >= EntryPrice Then
ExitLong("bx2",AtMarket);
Else
Sell("s4",AtMarket);
}
if IsEntryName("b3",0) == true and BarsSinceEntry == n Then
{
ExitLong("bx3",AtMarket);
}
if IsEntryName("b4",0) == true and BarsSinceEntry == n Then
{
ExitLong("bx4",AtMarket);
}
}
if MarketPosition == -1 Then
{
if IsEntryName("s1",0) == true and BarsSinceEntry == n Then
{
if NextBarOpen <= EntryPrice Then
ExitShort("sx1",AtMarket);
Else
Buy("b3",AtMarket);
}
if IsEntryName("s2",0) == true and BarsSinceEntry == n Then
{
if NextBarOpen <= EntryPrice Then
ExitShort("sx2",AtMarket);
Else
Buy("b4",AtMarket);
}
if IsEntryName("s3",0) == true and BarsSinceEntry == Then
{
ExitShort("sx3",AtMarket);
}
if IsEntryName("s4",0) == true and BarsSinceEntry == n Then
{
ExitShort("sx4",AtMarket);
}
}