커뮤니티
문의합니다.
2018-04-01 23:56:52
292
글번호 117830
안녕하세요?
아래 TradersStudio의 코드인데 Yeslanguge로 코딩 변환 부탁합니다.
감사합니다.
-----------------------
Function CAM(adxLen,macdLen1,macdLen2)
'adxLen=10,macdLen1=12,macdLen2=25
Dim theADX As BarArray
Dim theMACD As BarArray
Dim CAM_UP,CAM_PB,CAM_DN,CAM_CT
theADX = ADX(adxLen,0)
theMACD = MACD(C,macdLen1,macdLen2,0)
CAM_UP = theADX>=theADX[1] And theMACD>theMACD[1]
CAM_PB = theADX<=theADX[1] And theMACD<theMACD[1]
CAM_DN = theADX>=theADX[1] And theMACD<theMACD[1]
CAM_CT = theADX<=theADX[1] And theMACD>theMACD[1]
CAM = IIF(CAM_UP,2,IIF(CAM_DN,-2,IIF(CAM_PB,1,IIF(CAM_CT,-1,0))))
End Function
'----------------------------------------------------------------
'Indicator plot:
sub CAM_IND(adxLen,macdLen1,macdLen2)
plot1(CAM(adxLen,macdLen1,macdLen2))
End Sub
'----------------------------------------------------------------
'CAM trading systme (long only)
Sub CAM_DNCT(adxLen,macdLen1,macdLen2,cam1,cam2,exitBars)
'adxLen=10,macdLen1=12,macdLen2=25,cam1=-2,cam2=1,exitBars=12
Dim theCAM As BarArray
theCAM = CAM(adxLen,macdLen1,macdLen2)
If theCAM[1]=cam1 And theCAM=cam2 Then Buy("BuyDNCT",1,0,Market,Day)
If BarsSinceEntry>=exitBars Then ExitLong("LXtime","",1,0,Market,Day)
End Sub
'-----------------------------------------------------------------
답변 1
예스스탁 예스스탁 답변
2018-04-02 14:05:27
안녕하세요
예스스탁입니다.
사용자함수오 지표만 작성해 드립니다.
전략내용에는 어떤 내용인지 모르는 함수가 있습니다.
1사용자함수 : CAM
input : adxLen(Numeric),macdLen1(Numeric),macdLen2(Numeric);
var : theADX(0),theMACD(0);
var : CAM_UP(false),CAM_PB(false),CAM_DN(false),CAM_CT(false);
theADX = ADX(adxLen);
theMACD = MACD(macdLen1,macdLen2);
CAM_UP = theADX>=theADX[1] And theMACD>theMACD[1];
CAM_PB = theADX<=theADX[1] And theMACD<theMACD[1];
CAM_DN = theADX>=theADX[1] And theMACD<theMACD[1];
CAM_CT = theADX<=theADX[1] And theMACD>theMACD[1];
CAM = IfF(CAM_UP,2,IfF(CAM_DN,-2,IfF(CAM_PB,1,IFF(CAM_CT,-1,0))));
2 지표
input : adxLen(10),macdLen1(12),macdLen2(25);
plot1(CAM(adxLen,macdLen1,macdLen2));
즐거운 하루되세요
> 리턴 님이 쓴 글입니다.
> 제목 : 문의합니다.
> 안녕하세요?
아래 TradersStudio의 코드인데 Yeslanguge로 코딩 변환 부탁합니다.
감사합니다.
-----------------------
Function CAM(adxLen,macdLen1,macdLen2)
'adxLen=10,macdLen1=12,macdLen2=25
Dim theADX As BarArray
Dim theMACD As BarArray
Dim CAM_UP,CAM_PB,CAM_DN,CAM_CT
theADX = ADX(adxLen,0)
theMACD = MACD(C,macdLen1,macdLen2,0)
CAM_UP = theADX>=theADX[1] And theMACD>theMACD[1]
CAM_PB = theADX<=theADX[1] And theMACD<theMACD[1]
CAM_DN = theADX>=theADX[1] And theMACD<theMACD[1]
CAM_CT = theADX<=theADX[1] And theMACD>theMACD[1]
CAM = IIF(CAM_UP,2,IIF(CAM_DN,-2,IIF(CAM_PB,1,IIF(CAM_CT,-1,0))))
End Function
'----------------------------------------------------------------
'Indicator plot:
sub CAM_IND(adxLen,macdLen1,macdLen2)
plot1(CAM(adxLen,macdLen1,macdLen2))
End Sub
'----------------------------------------------------------------
'CAM trading systme (long only)
Sub CAM_DNCT(adxLen,macdLen1,macdLen2,cam1,cam2,exitBars)
'adxLen=10,macdLen1=12,macdLen2=25,cam1=-2,cam2=1,exitBars=12
Dim theCAM As BarArray
theCAM = CAM(adxLen,macdLen1,macdLen2)
If theCAM[1]=cam1 And theCAM=cam2 Then Buy("BuyDNCT",1,0,Market,Day)
If BarsSinceEntry>=exitBars Then ExitLong("LXtime","",1,0,Market,Day)
End Sub
'-----------------------------------------------------------------
다음글
이전글