예스스탁
예스스탁 답변
2009-09-15 16:17:31
안녕하세요
예스스탁입니다.
input : Short(5),Long(20),jong(60);
Value1 = data2(ma(c, Short));
Value2 = data2(ma(c, Long));
Value3 = data2(ma(c,jong));
Value4 = Value2*1.02;#20이평+2%
Value5 = Value2*0.99;#20이평-2%
Value6 = Value2*0.985;
Value7 = data2(EnvelopeUp(44,10));
Value8 = data2(ma(c,10));
if Value1 > Value2 and Value2 > value3 Then #정배열
var1=1;
if var1==1 and Value4>=h and Value2<=l Then{
if CrossUp(c,Value1) Then
buy("a",AtStop,Value1);
}
if MarketPosition == 1 and IsEntryName("a") == True Then{
if avgEntryPrice*1.05>=o and
highest(O,BarsSinceEntry) >= avgEntryPrice*1.02 and highest(O,BarsSinceEntry) < avgEntryPrice*1.07 then
ExitLong("1",AtStop,avgEntryPrice*1.01); #진입가격이 2%로 상승했을떄 1%마지노선
if avgEntryPrice*1.1>=o and
highest(O,BarsSinceEntry) >= avgEntryPrice*1.07 and highest(O,BarsSinceEntry) <= avgEntryPrice*1.1 Then
ExitLong("5",AtStop,avgEntryPrice*1.05);
if AvgEntryPrice*1.3>o and highest(O,BarsSinceEntry) >= avgEntryPrice*1.11 Then
ExitLong("7",AtStop,EntryPrice*1.07);
if avgEntryPrice*1.08<=c and CrossDown(c,Value8) then
ExitLong("10%",AtStop,Value8);
if CrossDown(c,Value6) Then
ExitLong("CUT",AtStop,Value6);
if CrossUp(h,Value7) and CrossDown(c,Value1) Then
ExitLong("b",AtStop,Value1);
}
atstop은 if문이 만족한 봉 다음봉 시세만을 감시합니다.
예를 들면 아래와 같은 수식은
if avgEntryPrice*1.05>=o and crossup(o,avgEntryPrice*1.02) then
ExitLong("1",AtStop,avgEntryPrice*1.01); #진입가격이 2%로 상승했을떄 1%마지노선
현재봉에서 시가가 평단가대비 2%이상 오르고 바로 다음봉에 1%로 떨어져야만 청산신호가 발생합니다.
atstop사용에 유의하시기 바랍니다.
즐거운 하루되세요
> hippomom 님이 쓴 글입니다.
> 제목 : 선물 에서의 수식 수정바랄께요
> 선물에서의 수식이라고 만들었는데 진입은 되는것 같은데 청산에서 %로 마지노선 잡는게 잘않 되네요...%가 문제가 있는것인지 아니면 수식자체가 문제가있는것인지 수정 바랍니다.
input : Short(5),Long(20),jong(60);
Value1 = data2(ma(c, Short));
Value2 = data2(ma(c, Long));
Value3 = data2(ma(c,jong));
Value4 = Value2*1.02;#20이평+2%
Value5 = Value2*0.99;#20이평-2%
Value6 = Value2*0.985;
Value7 = data2(EnvelopeUp(44,10));
Value8 = data2(ma(c,10));
if Value1 > Value2 and Value2 > value3 Then #정배열
var1=1;
if var1==1 and Value4>=h and Value2<=l Then{
if CrossUp(c,Value1) Then
buy("a",AtStop,Value1);
}
if MarketPosition == 1 and IsEntryName("a") == True Then{
if avgEntryPrice*1.05>=o and crossup(o,avgEntryPrice*1.02) then
ExitLong("1",AtStop,avgEntryPrice*1.01); #진입가격이 2%로 상승했을떄 1%마지노선
if avgEntryPrice*1.1>=o and Crossup(o,avgEntryPrice*1.07) Then
ExitLong("5",AtStop,avgEntryPrice*1.05);
if AvgEntryPrice*1.3>o and crossup(o,avgEntryPrice*1.1) Then
ExitLong("7",AtStop,EntryPrice*1.07);
if avgEntryPrice*1.08<=c and CrossDown(c,Value8) then
ExitLong("10%",AtStop,Value8);
if CrossDown(c,Value6) Then
ExitLong("CUT",AtStop,Value6);
if CrossUp(h,Value7) and CrossDown(c,Value1) Then
ExitLong("b",AtStop,Value1);
}