답변완료
문의 드립니다!
안녕하세요!
아래 2개의 수식에서 각각 발생되는 가로선과 가로선사이에 색상을 입히고싶습니다
* 수식1의 경우 라인1,2,3이 아닌 trend에 해당되는선 기준입니다
그럴려면 2개의 수식을 한개의 수식으로 통합해야할것같은데 가능한 방법으로 해결 부탁드립니다
색상은 사용지정이 가능했으면 합니다
감사합니다!!!
-----------------------------------------------------------------------------------
(수식 1)
input : n(0);
input : Periods(10),Multiplier(3.0),changeATR(true),showsignals(true),highlighting(true);
var : src(0),ATR2(0),ATrv(0),upv(0),dnv(0),trend(1);
src = (h+l)/2;
atr2 = ma(TrueRange, Periods);
atrv = iff(changeATR, atr(Periods), atr2);
upv = src-(Multiplier*atrv);
upv = iff(close[1] > upv[1],max(upv,upv[1]), upv);
dnv = src+(Multiplier*atrv);
dnv = iff(close[1] < dnv[1],min(dnv, dnv[1]), dnv);
trend = iff(trend == -1 and close > dnv[1] , 1 ,IFf(trend == 1 and close < upv[1] , -1 , trend));
if trend == 1 Then
plot1(upv,"Trend",MAGENTA);
Else
plot1(dnv,"Trend",blue);
if C > Plot1 Then
plot2(999999999,"라인1");
Else
plot2(0,"라인1");
var1 = IFf(Trend == 1,upv,dnv);
if CountIf(trend != 1,2) == 2 and
H < var1-PriceScale*n and H[1] >= var1[1]-PriceScale*n Then
{
plot3(999999999,"라인2");
PlaySound("C:₩예스트레이더₩data₩Sound₩.wav");
}
Else
plot3(0,"라인2");
if CountIf(trend == 1,2) == 2 and
L > var1+PriceScale*n and L[1] <= var1[1]+PriceScale*n Then
{
plot4(999999999,"라인3");
PlaySound("C:₩예스트레이더₩data₩Sound₩.wav");
}
Else
plot4(0,"라인3");
(수식 2)
var : tl1(0,data1),tl2(0,data1);
var : V1(Data1(C),data1);
var : V2(Data2(C),data2);
if CrossDown(data1(L),data2(H)) or
Crossup(data1(h),data2(L)) Then
{
v1 = data1(C);
}
plot1(v1);
plot2(v1);
plot3(v2);
if CrossDown(data1(L),data2(H)) or
Crossup(data1(h),data2(L)) Then
{
tl1 = TL_New(sdate,stime,9999999,sdate,stime,0);
TL_SetColor(tl1,black);
TL_SetSize(tl1,0);
}
2023-02-08
914
글번호 166097
지표
답변완료
시스템식 부탁드립니다.
항상 도움 주셔서 감사합니다.
아래 시스템식에서 하루 손실이 100 point 가 되면
매매를 중단하는 시스템식 부탁드립니다.
종목 : 마이크로 나스닥 100
차트 : 15분봉
#===============================================
Inputs : PT(50),SL(51);
Inputs : TS(10),TP(50);
Inputs : shortPeriod(5), longPeriod(20), SPeriod(9);
Inputs : T1(100),T2(15);
Var : MACDV(0), MACDsig(0) ;
### 해외선물 새벽시간 당일청산 ###
if sDate != sDate[1] Then
SetStopEndofday(060000);
if Bdate != Bdate[1] Then
SetStopEndofday(0);
### 일매매손익에 따른 손절 ###
##### 변수셋팅 #####
MACDV = MACD(shortPeriod, longPeriod);
MACDsig = ema(MACDV,SPeriod);
#--------------------------------------------------------------------------------------
##### 매매로직 #####
#--------------------------------------------------------------------------------------
if sTime >= 140000 and sTime <=2400000 or stime >= 000000 and sTime <= 070000 Then {
#--------------------------------------------------------------------------------------
#----------------------
# Long Entry 매수
#----------------------
If marketposition <= 0 and macdv > macdsig and macdv2 > 0 Then Begin
Buy("B1",OnClose,DEf,amt);
# Long Exit 익절 및 본청
if MarketPosition == 1 Then
{
if MaxEntries == 1 and C > dayopen() Then
{
ExitLong("BP1",AtLimit,AvgEntryPrice+T1);
}
if MaxEntries == 2 and C > dayopen() Then
ExitLong("BP2",AtLimit,AvgEntryPrice+T2);
if MaxEntries == 3 and C > dayopen() Then
ExitLong("BP3",AtLimit,AvgEntryPrice+T2);
if MaxEntries == 3 and C > dayopen() Then
ExitLong("BL",AtStop,AvgEntryPrice-T2*6);
if MaxEntries == 1 and C > dayopen() Then
Buy("B2",AtLimit,LatestEntryPrice(0)-T2,1);
if MaxEntries == 2 and C > dayopen() Then
Buy("B3",AtLimit,LatestEntryPrice(0)-T2,1);
#----------------------
# Short Entry 매도
#----------------------
# Short Entry MACD
If marketposition >= 0 and macdv < macdsig and macdv2 < 0 Then Begin
Sell("S1",OnClose,DEf,amt);
End;
# Short Exit 익절 및 본청
if MarketPosition == -1 Then
{
if MaxEntries == 1 and C < dayopen() Then
{
ExitShort("SP1",AtLimit,AvgEntryPrice-T1);
}
if MaxEntries == 2 and C < dayopen() Then
ExitShort("SP2",AtLimit,AvgEntryPrice-T2);
if MaxEntries == 3 and C < dayopen() Then
ExitShort("SP3",AtLimit,AvgEntryPrice-T2);
if MaxEntries == 3 and C < dayopen() Then
ExitShort("SL",AtStop,AvgEntryPrice+T2*6);
if MaxEntries == 1 and C < dayopen() Then
Sell("S2",AtLimit,LatestEntryPrice(0)+T2,1);
if MaxEntries == 2 and C < dayopen() Then
Sell("S3",AtLimit,LatestEntryPrice(0)+T2,1);
}
#--------------------------------------------------------------------------------------
} //매매시간 종료
#--------------------------------------------------------------------------------------
##### 포지션 익절, 손절 #####
#--------------------------------------------------------------------------------------
##### 스탑로스 #####
SetStopLoss(SL,PointStop);
SetStopTrailing(TS,TP,PointStop);
감사합니다.
2023-02-08
696
글번호 166093
시스템