커뮤니티
수식문의드립니다..
2015-04-10 01:45:24
202
글번호 84917
답변 감사함니다
근데 계속 에러메세지가 떠서 문의 드립니다..
어디가 틀린건지///
주석도 부탁합니다....--
var1 = ma(c,30);
if MarketPosition == 0 and crossup(c,var1) Then
buy("b");
if MarketPosition == 0 and CrossDown(c,var1) Then
sell();
if MarketPosition == 1 Then{
if crossup(c,var1) Then{
buy("bb");
}
if MarketPosition == 1 Then{
if CrossDown(c,var1) Then{
sell();
}
exitlong("bP",atlimit,EntryPrice+PriceScale*20);
if highest(h,BarsSinceEntry) >= EntryPrice+PriceScale*10 Then{
ExitLong("bx",AtStop,EntryPrice);
Else
ExitLong("bx1",AtStop,EntryPrice-PriceScale*10);
}
ExitShort("sP",atlimit,EntryPrice+PriceScale*20);
if highest(h,BarsSinceEntry) >= EntryPrice+PriceScale*10 Then{
ExitShort("sx",AtStop,EntryPrice);
Else
ExitShort("sx1",AtStop,EntryPrice-PriceScale*10);}
답변 1
예스스탁 예스스탁 답변
2015-04-10 08:25:02
안녕하세요
예스스탁입니다.
var1 = ma(c,30);
if MarketPosition == 0 and crossup(c,var1) Then
buy("b");
if MarketPosition == 0 and CrossDown(c,var1) Then
sell("s");
if MarketPosition == 1 Then{
if crossup(c,var1) Then{
buy("bb");
}
exitlong("bP",atlimit,EntryPrice+PriceScale*20);
if highest(h,BarsSinceEntry) >= EntryPrice+PriceScale*10 Then
ExitLong("bx",AtStop,EntryPrice);
Else
ExitLong("bx1",AtStop,EntryPrice-PriceScale*10);
}
if MarketPosition == -1 Then{
if CrossDown(c,var1) Then{
sell("ss");
}
ExitShort("sP",atlimit,EntryPrice+PriceScale*20);
if highest(h,BarsSinceEntry) >= EntryPrice+PriceScale*10 Then
ExitShort("sx",AtStop,EntryPrice);
Else
ExitShort("sx1",AtStop,EntryPrice-PriceScale*10);
}
만약 추가진입을 1회만 허용하실경우에는 아래와 같이 처리하시면 됩니다.
var1 = ma(c,30);
if MarketPosition == 0 and crossup(c,var1) Then
buy("b");
if MarketPosition == 0 and CrossDown(c,var1) Then
sell("s");
if MarketPosition == 1 Then{
if MaxEntries == 1 and crossup(c,var1) Then{
buy("bb");
}
exitlong("bP",atlimit,EntryPrice+PriceScale*20);
if highest(h,BarsSinceEntry) >= EntryPrice+PriceScale*10 Then
ExitLong("bx",AtStop,EntryPrice);
Else
ExitLong("bx1",AtStop,EntryPrice-PriceScale*10);
}
if MarketPosition == -1 Then{
if MaxEntries == 1 and CrossDown(c,var1) Then{
sell("ss");
}
ExitShort("sP",atlimit,EntryPrice+PriceScale*20);
if highest(h,BarsSinceEntry) >= EntryPrice+PriceScale*10 Then
ExitShort("sx",AtStop,EntryPrice);
Else
ExitShort("sx1",AtStop,EntryPrice-PriceScale*10);
}
즐거운 하루되세요
> 고구미 님이 쓴 글입니다.
> 제목 : 수식문의드립니다..
> 답변 감사함니다
근데 계속 에러메세지가 떠서 문의 드립니다..
어디가 틀린건지///
주석도 부탁합니다....--
var1 = ma(c,30);
if MarketPosition == 0 and crossup(c,var1) Then
buy("b");
if MarketPosition == 0 and CrossDown(c,var1) Then
sell();
if MarketPosition == 1 Then{
if crossup(c,var1) Then{
buy("bb");
}
if MarketPosition == 1 Then{
if CrossDown(c,var1) Then{
sell();
}
exitlong("bP",atlimit,EntryPrice+PriceScale*20);
if highest(h,BarsSinceEntry) >= EntryPrice+PriceScale*10 Then{
ExitLong("bx",AtStop,EntryPrice);
Else
ExitLong("bx1",AtStop,EntryPrice-PriceScale*10);
}
ExitShort("sP",atlimit,EntryPrice+PriceScale*20);
if highest(h,BarsSinceEntry) >= EntryPrice+PriceScale*10 Then{
ExitShort("sx",AtStop,EntryPrice);
Else
ExitShort("sx1",AtStop,EntryPrice-PriceScale*10);}