커뮤니티
수정 요청 드립니다.
2015-06-15 10:15:05
82
글번호 87191
아래수식에서 매도 매수 구분한 진입의 횟수 제한, 당일손실 제한 수식을
매수 매도을 합한 진입의 횟수 제한, 당일손실 제한 수식으로 수정 요청드립니다.
예) input : BuySellN(3),당일손실(-1.5); => 매수 매도 구분없이 하루 3회로 진입 횟수 제한
=> 매수->매도->매수, 매도->매수->매도, => 3회로 진입 횟수 제한.
input : buyN(1),SellN(1),당일손실(-1.5);
var : cnt(0),BCount(0),SCount(0);
var : NP(0),PreNP(0),DayPL(0);
NP = NetProfit;
if date != date[1] Then
preNP = NP[1];
dayPL = NP-PreNP;
BCount = 0 ;
SCount = 0 ;
for cnt = 0 to 10 {
if EntryDate(cnt) == sdate and MarketPosition(cnt) == 1 then
BCount = BCount + 1;
if EntryDate(cnt) == sdate and MarketPosition(cnt) == -1 then
SCount = SCount + 1;
}
//------------------------------------------------------------------------
if MarketPosition == 1 Then{
ExitLong("당일손실제한bx3",AtStop,EntryPrice+당일손실-dayPL);
}
if MarketPosition == -1 Then{
ExitShort("당일손실제한sx3",AtStop,EntryPrice-당일손실+daypl );
}
//--------------------------------------------------------------------------------------
if MarketPosition == -1 and crossup(H,EntryPrice+0.5) and BCount < BuyN and dayPL > 당일손실 Then
buy("1BX");
if MarketPosition == 1 and CrossDown(L,EntryPrice-0.5) and SCount < SellN and dayPL > 당일손실 Then
sell("1SX");
//--------------------------------------------------------------------------------------
Value1 = Highest(H, BarsSinceEntry-100);
if BCount < SellN and daypl > 당일손실 Then
Buy("매수추적청산",AtStop, Value1-ATR(15)*5);
Value2 = Lowest(L, BarsSinceEntry-100);
if SCount < buyN and daypl > 당일손실 Then
sell("매도추적청산",AtStop, Value2-ATR(15)*5);
감사합니다.
답변 1
예스스탁 예스스탁 답변
2015-06-15 13:45:08
안녕하세요
예스스탁입니다.
input :N(3),당일손실(-1.5);
var : cnt(0),BCount(0),SCount(0);
var : NP(0),PreNP(0),DayPL(0);
NP = NetProfit;
if date != date[1] Then
preNP = NP[1];
dayPL = NP-PreNP;
BCount = 0 ;
SCount = 0 ;
for cnt = 0 to 10 {
if EntryDate(cnt) == sdate and MarketPosition(cnt) == 1 then
BCount = BCount + 1;
if EntryDate(cnt) == sdate and MarketPosition(cnt) == -1 then
SCount = SCount + 1;
}
//------------------------------------------------------------------------
if MarketPosition == 1 Then{
ExitLong("당일손실제한bx3",AtStop,EntryPrice+당일손실-dayPL);
}
if MarketPosition == -1 Then{
ExitShort("당일손실제한sx3",AtStop,EntryPrice-당일손실+daypl );
}
//--------------------------------------------------------------------------------------
if MarketPosition == -1 and crossup(H,EntryPrice+0.5) and BCount+SCount < N and dayPL > 당일손실 Then
buy("1BX");
if MarketPosition == 1 and CrossDown(L,EntryPrice-0.5) and BCount+SCount < N and dayPL > 당일손실 Then
sell("1SX");
//--------------------------------------------------------------------------------------
Value1 = Highest(H, BarsSinceEntry-100);
if BCount+SCount < N and daypl > 당일손실 Then
Buy("매수추적청산",AtStop, Value1-ATR(15)*5);
Value2 = Lowest(L, BarsSinceEntry-100);
if BCount+SCount < N and daypl > 당일손실 Then
sell("매도추적청산",AtStop, Value2-ATR(15)*5);
즐거운 하루되세요
> dandy 님이 쓴 글입니다.
> 제목 : 수정 요청 드립니다.
> 아래수식에서 매도 매수 구분한 진입의 횟수 제한, 당일손실 제한 수식을
매수 매도을 합한 진입의 횟수 제한, 당일손실 제한 수식으로 수정 요청드립니다.
예) input : BuySellN(3),당일손실(-1.5); => 매수 매도 구분없이 하루 3회로 진입 횟수 제한
=> 매수->매도->매수, 매도->매수->매도, => 3회로 진입 횟수 제한.
input : buyN(1),SellN(1),당일손실(-1.5);
var : cnt(0),BCount(0),SCount(0);
var : NP(0),PreNP(0),DayPL(0);
NP = NetProfit;
if date != date[1] Then
preNP = NP[1];
dayPL = NP-PreNP;
BCount = 0 ;
SCount = 0 ;
for cnt = 0 to 10 {
if EntryDate(cnt) == sdate and MarketPosition(cnt) == 1 then
BCount = BCount + 1;
if EntryDate(cnt) == sdate and MarketPosition(cnt) == -1 then
SCount = SCount + 1;
}
//------------------------------------------------------------------------
if MarketPosition == 1 Then{
ExitLong("당일손실제한bx3",AtStop,EntryPrice+당일손실-dayPL);
}
if MarketPosition == -1 Then{
ExitShort("당일손실제한sx3",AtStop,EntryPrice-당일손실+daypl );
}
//--------------------------------------------------------------------------------------
if MarketPosition == -1 and crossup(H,EntryPrice+0.5) and BCount < BuyN and dayPL > 당일손실 Then
buy("1BX");
if MarketPosition == 1 and CrossDown(L,EntryPrice-0.5) and SCount < SellN and dayPL > 당일손실 Then
sell("1SX");
//--------------------------------------------------------------------------------------
Value1 = Highest(H, BarsSinceEntry-100);
if BCount < SellN and daypl > 당일손실 Then
Buy("매수추적청산",AtStop, Value1-ATR(15)*5);
Value2 = Lowest(L, BarsSinceEntry-100);
if SCount < buyN and daypl > 당일손실 Then
sell("매도추적청산",AtStop, Value2-ATR(15)*5);
감사합니다.