커뮤니티

시스템 수식 문의드립니다.

프로필 이미지
수다리
2020-08-31 17:00:41
691
글번호 141943
답변완료
아래 수식에 총 4개의 신호가 있는데요 현재 수식의 수익 표시는 "첫번째 매수신호" , "첫번째 매도신호" 진입가격을 기준으로 차트상에 수익이 표시됩니다. 이것을 "두번째 매수신호" , "두번째 매도신호" 의 진입가격 기준으로 수익표시를 하려고 하면 수식을 어떻게 수정해야 하나요? 평균가격이 아닌 두번째 신호의 진입가격을 기준으로 수익을 표시하고 싶습니다. if CrossUp(C,ma(c,120)) and (MarketPosition == 0 or MarketPosition == -1) Then { buy("첫번째 매수신호"); } if EntryPrice-PriceScale*30 > C and CurrentContracts == 1 Then { buy("두번째 매수신호"); } //----------------------------------- if CrossDown(C,ma(c,120)) and (MarketPosition == 0 or MarketPosition == 1) Then { Sell("첫번째 매도신호"); } if EntryPrice+PriceScale*30 < C and CurrentContracts == 1 Then { Sell("두번째 매도신호"); } //실시간 수익틱수표시 var : pp(0),ll(0),tx3(0),tx4(0); if MarketPosition == 1 Then { pp = Floor((highest(H,BarsSinceEntry)-EntryPrice)/(PriceScale*1)); ll = Floor((EntryPrice-lowest(L,BarsSinceEntry))/(PriceScale*1)); if pp > pp[1] Then { tx3 = Text_New(sdate,stime,H+PriceScale*3,NumToStr(pp*1,0)+"틱"); Text_SetStyle(tx3,2,1); Text_SetSize(tx3,10); Text_SetColor(tx3,RED); } if ll > ll[1] Then { tx4 = Text_New(sdate,stime,L+PriceScale*3,NumToStr(-ll*1,0)+"틱"); Text_SetStyle(tx4,2,1); Text_SetSize(tx4,10); Text_SetColor(tx4,BLUE); } } if MarketPosition == -1 Then { pp = Floor((EntryPrice-lowest(L,BarsSinceEntry))/(PriceScale*1)); ll = Floor((highest(H,BarsSinceEntry)-EntryPrice)/(PriceScale*1)); if pp > pp[1] Then { tx3 = Text_New(sdate,stime,L-PriceScale*3,NumToStr(pp*1,0)+"틱"); Text_SetStyle(tx3,2,0); Text_SetSize(tx3,10); Text_SetColor(tx3,RED); } if ll > ll[1] Then { tx4 = Text_New(sdate,stime,H-PriceScale*3,NumToStr(-ll*1,0)+"틱"); Text_SetStyle(tx4,2,0); Text_SetSize(tx4,10); Text_SetColor(tx4,BLUE); } }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2020-09-01 10:01:34

안녕하세요 예스스탁입니다. if CrossUp(C,ma(c,120)) and (MarketPosition == 0 or MarketPosition == -1) Then { buy("첫번째 매수신호"); } if MarketPosition == 1 and EntryPrice-PriceScale*30 > C and CurrentContracts == 1 Then { buy("두번째 매수신호"); } //----------------------------------- if CrossDown(C,ma(c,120)) and (MarketPosition == 0 or MarketPosition == 1) Then { Sell("첫번째 매도신호"); } if MarketPosition == -1 and EntryPrice+PriceScale*30 < C and CurrentContracts == 1 Then { Sell("두번째 매도신호"); } //실시간 수익틱수표시 var : pp(0),ll(0),tx3(0),tx4(0); var : BP2(0),BH2(0),BL2(0); var : SP2(0),SH2(0),SL2(0); if MarketPosition == 1 Then { if CurrentContracts > CurrentContracts[1] and MaxEntries == 2 Then { BP2 = LatestEntryPrice(0); BH2 = H; BL2 = L; } if BP2 > 0 Then { if H > BH2 Then BH2 = H; if L < BL2 Then BL2 = L; pp = Floor((BH2-BP2)/(PriceScale*1)); ll = Floor((BP2-BL2)/(PriceScale*1)); if pp > pp[1] Then { tx3 = Text_New(sdate,stime,H+PriceScale*3,NumToStr(pp*1,0)+"틱"); Text_SetStyle(tx3,2,1); Text_SetSize(tx3,10); Text_SetColor(tx3,RED); } if ll > ll[1] Then { tx4 = Text_New(sdate,stime,L+PriceScale*3,NumToStr(-ll*1,0)+"틱"); Text_SetStyle(tx4,2,1); Text_SetSize(tx4,10); Text_SetColor(tx4,BLUE); } } } Else BP2 = 0; if MarketPosition == -1 Then { if CurrentContracts > CurrentContracts[1] and MaxEntries == 2 Then { SP2 = LatestEntryPrice(0); SH2 = H; SL2 = L; } if SP2 > 0 Then { if H > SH2 Then SH2 = H; if L < SL2 Then SL2 = L; pp = Floor((EntryPrice-SL2)/(PriceScale*1)); ll = Floor((SH2-EntryPrice)/(PriceScale*1)); if pp > pp[1] Then { tx3 = Text_New(sdate,stime,L-PriceScale*3,NumToStr(pp*1,0)+"틱"); Text_SetStyle(tx3,2,0); Text_SetSize(tx3,10); Text_SetColor(tx3,RED); } if ll > ll[1] Then { tx4 = Text_New(sdate,stime,H-PriceScale*3,NumToStr(-ll*1,0)+"틱"); Text_SetStyle(tx4,2,0); Text_SetSize(tx4,10); Text_SetColor(tx4,BLUE); } } } Else SP2 = 0; 즐거운 하루되세요 > 수다리 님이 쓴 글입니다. > 제목 : 시스템 수식 문의드립니다. > 아래 수식에 총 4개의 신호가 있는데요 현재 수식의 수익 표시는 "첫번째 매수신호" , "첫번째 매도신호" 진입가격을 기준으로 차트상에 수익이 표시됩니다. 이것을 "두번째 매수신호" , "두번째 매도신호" 의 진입가격 기준으로 수익표시를 하려고 하면 수식을 어떻게 수정해야 하나요? 평균가격이 아닌 두번째 신호의 진입가격을 기준으로 수익을 표시하고 싶습니다. if CrossUp(C,ma(c,120)) and (MarketPosition == 0 or MarketPosition == -1) Then { buy("첫번째 매수신호"); } if EntryPrice-PriceScale*30 > C and CurrentContracts == 1 Then { buy("두번째 매수신호"); } //----------------------------------- if CrossDown(C,ma(c,120)) and (MarketPosition == 0 or MarketPosition == 1) Then { Sell("첫번째 매도신호"); } if EntryPrice+PriceScale*30 < C and CurrentContracts == 1 Then { Sell("두번째 매도신호"); } //실시간 수익틱수표시 var : pp(0),ll(0),tx3(0),tx4(0); if MarketPosition == 1 Then { pp = Floor((highest(H,BarsSinceEntry)-EntryPrice)/(PriceScale*1)); ll = Floor((EntryPrice-lowest(L,BarsSinceEntry))/(PriceScale*1)); if pp > pp[1] Then { tx3 = Text_New(sdate,stime,H+PriceScale*3,NumToStr(pp*1,0)+"틱"); Text_SetStyle(tx3,2,1); Text_SetSize(tx3,10); Text_SetColor(tx3,RED); } if ll > ll[1] Then { tx4 = Text_New(sdate,stime,L+PriceScale*3,NumToStr(-ll*1,0)+"틱"); Text_SetStyle(tx4,2,1); Text_SetSize(tx4,10); Text_SetColor(tx4,BLUE); } } if MarketPosition == -1 Then { pp = Floor((EntryPrice-lowest(L,BarsSinceEntry))/(PriceScale*1)); ll = Floor((highest(H,BarsSinceEntry)-EntryPrice)/(PriceScale*1)); if pp > pp[1] Then { tx3 = Text_New(sdate,stime,L-PriceScale*3,NumToStr(pp*1,0)+"틱"); Text_SetStyle(tx3,2,0); Text_SetSize(tx3,10); Text_SetColor(tx3,RED); } if ll > ll[1] Then { tx4 = Text_New(sdate,stime,H-PriceScale*3,NumToStr(-ll*1,0)+"틱"); Text_SetStyle(tx4,2,0); Text_SetSize(tx4,10); Text_SetColor(tx4,BLUE); } }