커뮤니티
수식 문의
2015-06-02 08:46:32
130
글번호 86678
언제나 한결같은 답변 감사드립니다.
아래 샘플은 데이, 리버스 시스템식인데요
당일 긴 추세의 수익 확보 후 더 이상 매매를 하지 않고자,
직전거래손익이 2.5P 이상이고 당일 첫거래에서 직전거래까지의 손익의 합이 2.0P 이상일때는 당일매매 금지 수식을 추가하고 싶습니다.(직전거래손익 및 직전거래까지의 손익의 합은 외부변수로 처리)
답변 기다리겠습니다 수고하십시요
===================== 수식 ======================
Input : Period(12), Period1(5), Period2(5), LossPoint(0.5), 당일손실(1);
var : NP(0),PreNP(0),dayPL(0);
value1 = StochasticsK(Period,Period1);
value2 = StochasticsD(Period,Period1,Period2);
NP = NetProfit;
if date != date[1] Then
PreNP = NP[1];
dayPL = NP-PreNP+PositionProfit;
# 매수/매도청산
If CrossUP(value1, value2) and dayPL >-당일손실 Then
{
Buy();
}
# 매도/매수청산
If CrossDown(value1, value2) and dayPL >-당일손실 Then
{
Sell();
}
SetStopLoss(LossPoint, PointStop);
SetStopEndofday(145900);
답변 1
예스스탁 예스스탁 답변
2015-06-02 12:02:02
안녕하세요
예스스탁입니다.
Input : Period(12), Period1(5), Period2(5), LossPoint(0.5), 당일손실(1),당일수익(2.0),직전거래손익(2.5);
var : NP(0),PreNP(0),dayPL(0),cnt(0),count(0);
value1 = StochasticsK(Period,Period1);
value2 = StochasticsD(Period,Period1,Period2);
NP = NetProfit;
if date != date[1] Then
PreNP = NP[1];
dayPL = NP-PreNP+PositionProfit;
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
# 매수/매도청산
If CrossUP(value1, value2) and dayPL >-당일손실 and dayPL < 당일수익 Then
{
if (MarketPosition == 0 and count == 0) Or
(MarketPosition == 0 and count >= 1 and PositionProfit(1) < 직전거래손익) or
MarketPosition == -1 then
Buy();
}
# 매도/매수청산
If CrossDown(value1, value2) and dayPL >-당일손실 and dayPL < 당일수익 Then
{
if (MarketPosition == 0 and count == 0) Or
(MarketPosition == 0 and count >= 1 and PositionProfit(1) < 직전거래손익) or
MarketPosition == 1 then
Sell();
}
SetStopLoss(LossPoint, PointStop);
SetStopEndofday(145900);
즐거운 하루되세요
> 탄젠트80 님이 쓴 글입니다.
> 제목 : 수식 문의
> 언제나 한결같은 답변 감사드립니다.
아래 샘플은 데이, 리버스 시스템식인데요
당일 긴 추세의 수익 확보 후 더 이상 매매를 하지 않고자,
직전거래손익이 2.5P 이상이고 당일 첫거래에서 직전거래까지의 손익의 합이 2.0P 이상일때는 당일매매 금지 수식을 추가하고 싶습니다.(직전거래손익 및 직전거래까지의 손익의 합은 외부변수로 처리)
답변 기다리겠습니다 수고하십시요
===================== 수식 ======================
Input : Period(12), Period1(5), Period2(5), LossPoint(0.5), 당일손실(1);
var : NP(0),PreNP(0),dayPL(0);
value1 = StochasticsK(Period,Period1);
value2 = StochasticsD(Period,Period1,Period2);
NP = NetProfit;
if date != date[1] Then
PreNP = NP[1];
dayPL = NP-PreNP+PositionProfit;
# 매수/매도청산
If CrossUP(value1, value2) and dayPL >-당일손실 Then
{
Buy();
}
# 매도/매수청산
If CrossDown(value1, value2) and dayPL >-당일손실 Then
{
Sell();
}
SetStopLoss(LossPoint, PointStop);
SetStopEndofday(145900);
다음글
이전글