커뮤니티

질문 부탁드립니다

프로필 이미지
yamu
2025-06-16 09:53:54
171
글번호 191728
답변완료
수고가 많으십니다 질문 몇 가지 부탁드립니다 질문1) 수식 해석 관련 질문 부탁합니다 동시에 조건을 만족할때 검색을 하는 식인데요 각 부분에서 else condition=false 를 설정할때와 안할때는 어떤 차이가 나나요? 감사합니다 if tl_getvalue(tl1,sdate,stime) >0 and tl_getvalue(tl2,sdate,stime) >0 and tl_getvalue(tl3,sdate,stime)>0 then { value1=tl_getvalue(tl1,sdate,stime); value2=tl_getvalue(tl2,sdate,stime); value3=tl_Getvalue(tl3,sdate,stime); if crossup(c,value1) then condition1= true; else condition1=false; if crossup(c,value2) then condition2=true; else condition2 = false; if crossup(c,value3) then condition3=true; else condition3 = false; if Condition1==true and condition2==true and condition3==true then find(1); } 질문2) for cnt= 80 downto 70 if index==cnt and h[cnt] > aa[1] then condition1=true; 이렇게 작성했을때 (if index==80 and h[80]>aa[1]) and (if index==79 and h[79]>aa[1]) ... and (if index==70 and h[70]>aa[1] ) then condition1= true; 이렇게 되는게 맞나요?? count=0; for cnt=80 downto 70 { if index==cnt and h[cnt]>aa[1] then count=count+1 } if count==11 then condition1=true; 이거랑 같은 의미가 되는건지 궁금합니다 질문3) 논리형 변수를 생성할때 for 문으로 작성 가능한지 여쭤보고 싶습니다 예를 들어서 아래와 같은 진행되는 조건이 있을때 (id[] 배열에는 조건만족시 index 값을 넣었습니다) for cnt= id[0] downto id[1] if index==cnt and h[cnt] > aa[1] then condition1=true; for cnt= id[1] downto id[2] if index==cnt and h[cnt] > aa[2] then condition2=true; ... for cnt= id[8] downto id[9] if index==cnt and h[cnt] > aa[9] then condition9=true; 이런 수식을 for y=0 to 8 { for cnt= id[y] downto id[y+1] { if index==cnt and h[cnt]>aa[y+1] then condition=true; } } 반복문으로 만들었는데요 condition 변수를 혹시 condition(y+1)=true; 이런식으로 만들어서 1부터 9번까지 반복 생성하게 하는 방법이 있을까요? 이런방식이 안된다면 가능한 방식으로 알려주시면 감사하겠습니다
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2025-06-16 11:08:25

안녕하세요 예스스탁입니다. 1 변수에 값이 한번 저장되면 그값이 계속 유지가 됩니다. false로 값 저장하는 내용이 없으면 한번 true가 저장되면 차트 마지막봉까지 계속 true입니다/ 2 나열해서 작성한 것과 같습니다. 다만 if count==11 then condition1=true와는 다른내용입니다. for cnt= 80 downto 70 if index==cnt and h[cnt] > aa[1] then condition1=true; 위 내용은 한개이상 만족하면 true입니다. 아래와 같게 됩니다. if count >=1 then condition1=true 3 기본제공 변수의 숫자를 변경할 방법은 없습니다. 변수를 배열로 만들어 사용하셔야 합니다. array : condition[10](False); 즐거운 하루되세요 > yamu 님이 쓴 글입니다. > 제목 : 질문 부탁드립니다 > 수고가 많으십니다 질문 몇 가지 부탁드립니다 질문1) 수식 해석 관련 질문 부탁합니다 동시에 조건을 만족할때 검색을 하는 식인데요 각 부분에서 else condition=false 를 설정할때와 안할때는 어떤 차이가 나나요? 감사합니다 if tl_getvalue(tl1,sdate,stime) >0 and tl_getvalue(tl2,sdate,stime) >0 and tl_getvalue(tl3,sdate,stime)>0 then { value1=tl_getvalue(tl1,sdate,stime); value2=tl_getvalue(tl2,sdate,stime); value3=tl_Getvalue(tl3,sdate,stime); if crossup(c,value1) then condition1= true; else condition1=false; if crossup(c,value2) then condition2=true; else condition2 = false; if crossup(c,value3) then condition3=true; else condition3 = false; if Condition1==true and condition2==true and condition3==true then find(1); } 질문2) for cnt= 80 downto 70 if index==cnt and h[cnt] > aa[1] then condition1=true; 이렇게 작성했을때 (if index==80 and h[80]>aa[1]) and (if index==79 and h[79]>aa[1]) ... and (if index==70 and h[70]>aa[1] ) then condition1= true; 이렇게 되는게 맞나요?? count=0; for cnt=80 downto 70 { if index==cnt and h[cnt]>aa[1] then count=count+1 } if count==11 then condition1=true; 이거랑 같은 의미가 되는건지 궁금합니다 질문3) 논리형 변수를 생성할때 for 문으로 작성 가능한지 여쭤보고 싶습니다 예를 들어서 아래와 같은 진행되는 조건이 있을때 (id[] 배열에는 조건만족시 index 값을 넣었습니다) for cnt= id[0] downto id[1] if index==cnt and h[cnt] > aa[1] then condition1=true; for cnt= id[1] downto id[2] if index==cnt and h[cnt] > aa[2] then condition2=true; ... for cnt= id[8] downto id[9] if index==cnt and h[cnt] > aa[9] then condition9=true; 이런 수식을 for y=0 to 8 { for cnt= id[y] downto id[y+1] { if index==cnt and h[cnt]>aa[y+1] then condition=true; } } 반복문으로 만들었는데요 condition 변수를 혹시 condition(y+1)=true; 이런식으로 만들어서 1부터 9번까지 반복 생성하게 하는 방법이 있을까요? 이런방식이 안된다면 가능한 방식으로 알려주시면 감사하겠습니다