커뮤니티

수식 문의

프로필 이미지
흑수돌
2023-04-19 12:38:50
978
글번호 168322
답변완료
아래의 mt4 수식을 예스로직으로 변환하고 싶습니다. 변환이 안되면 안되는 부분과 이유를 말씀해 주시면 다시 찾아 보겠습니다. 완연한 봄입니다. 건강 잘 챙기시고 항상 감사하다는 말씀 드립니다. ======================================= //Channel Indicator #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_color2 Red //Indicator parameters extern int period = 20; //Period for calculating the highest high and lowest low extern double multiplier = 2.0; //Multiplier to determine the channel width //Indicator buffers double upperBand[]; double lowerBand[]; //Indicator calculation function int init() { SetIndexBuffer(0, upperBand); SetIndexBuffer(1, lowerBand); SetIndexStyle(0, DRAW_LINE); SetIndexStyle(1, DRAW_LINE); SetIndexLabel(0, "CapChannel Upper"); SetIndexLabel(1, "CapChannel Lower"); IndicatorShortName("CapChannel"); return(INIT_SUCCEEDED); } int start() { int limit; double highestHigh, lowestLow, range; for (int i = 0; i < Bars - period; i++) { highestHigh = High[iHighest(NULL, 0, MODE_HIGH, period, i)]; lowestLow = Low[iLowest(NULL, 0, MODE_LOW, period, i)]; range = (highestHigh - lowestLow) * multiplier / 100.0; upperBand[i] = highestHigh + range; lowerBand[i] = lowestLow - range; } return(0); } ====================================== 코드는 계산된 채널의 상한 및 하한 경계를 저장하는 데 사용되는 두 개의 버퍼 "upperBand" 및 "lowerBand"를 정의합니다. "주기" 및 "승수" 입력 매개변수는 사용자가 지표 설정을 사용자 정의하기 위해 조정할 수 있습니다. "start()" 함수에서 지표는 내장된 iHighest() 및 iLowest() 함수를 사용하여 지정된 기간 동안 최고가 및 최저가를 계산합니다. 그런 다음 사용자 정의 승수를 기준으로 채널 폭을 계산하고 그에 따라 상한 및 하한을 설정합니다. 지표는 SetIndexBuffer(), SetIndexStyle() 및 SetIndexLabel() 함수를 사용하여 지표 버퍼를 정의하고 차트에서 지표의 모양을 사용자 정의합니다. 마지막으로 IndicatorShortName() 함수는 표시기에 사용자에게 친숙한 이름을 지정하는 데 사용됩니다.
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2023-04-20 11:36:23

안녕하세요 예스스탁입니다. input : period(20),multiplier(2.0); var : highestHigh(0),lowestLow(0),upperBand(0),lowerBand(0),R(0); highestHigh = highest(H,Period); lowestLow = lowest(L,Period); R = (highestHigh - lowestLow) * multiplier / 100.0; upperBand = highestHigh + R; lowerBand = lowestLow - R; Plot1(upperBand); plot2(lowerBand); 즐거운 하루되세요 > 흑수돌 님이 쓴 글입니다. > 제목 : 수식 문의 > 아래의 mt4 수식을 예스로직으로 변환하고 싶습니다. 변환이 안되면 안되는 부분과 이유를 말씀해 주시면 다시 찾아 보겠습니다. 완연한 봄입니다. 건강 잘 챙기시고 항상 감사하다는 말씀 드립니다. ======================================= //Channel Indicator #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_color2 Red //Indicator parameters extern int period = 20; //Period for calculating the highest high and lowest low extern double multiplier = 2.0; //Multiplier to determine the channel width //Indicator buffers double upperBand[]; double lowerBand[]; //Indicator calculation function int init() { SetIndexBuffer(0, upperBand); SetIndexBuffer(1, lowerBand); SetIndexStyle(0, DRAW_LINE); SetIndexStyle(1, DRAW_LINE); SetIndexLabel(0, "CapChannel Upper"); SetIndexLabel(1, "CapChannel Lower"); IndicatorShortName("CapChannel"); return(INIT_SUCCEEDED); } int start() { int limit; double highestHigh, lowestLow, range; for (int i = 0; i < Bars - period; i++) { highestHigh = High[iHighest(NULL, 0, MODE_HIGH, period, i)]; lowestLow = Low[iLowest(NULL, 0, MODE_LOW, period, i)]; range = (highestHigh - lowestLow) * multiplier / 100.0; upperBand[i] = highestHigh + range; lowerBand[i] = lowestLow - range; } return(0); } ====================================== 코드는 계산된 채널의 상한 및 하한 경계를 저장하는 데 사용되는 두 개의 버퍼 "upperBand" 및 "lowerBand"를 정의합니다. "주기" 및 "승수" 입력 매개변수는 사용자가 지표 설정을 사용자 정의하기 위해 조정할 수 있습니다. "start()" 함수에서 지표는 내장된 iHighest() 및 iLowest() 함수를 사용하여 지정된 기간 동안 최고가 및 최저가를 계산합니다. 그런 다음 사용자 정의 승수를 기준으로 채널 폭을 계산하고 그에 따라 상한 및 하한을 설정합니다. 지표는 SetIndexBuffer(), SetIndexStyle() 및 SetIndexLabel() 함수를 사용하여 지표 버퍼를 정의하고 차트에서 지표의 모양을 사용자 정의합니다. 마지막으로 IndicatorShortName() 함수는 표시기에 사용자에게 친숙한 이름을 지정하는 데 사용됩니다.