CYCLE SWING MOMENTUM
Forums › ProRealTime foro Español › Soporte ProBuilder › CYCLE SWING MOMENTUM
- This topic has 1 reply, 2 voices, and was last updated 6 months ago by Iván.
Viewing 2 posts - 1 through 2 (of 2 total)
-
-
02/21/2024 at 6:30 PM #228521
Hola a tod@s. Puede alguien transcribir el siguiente indicador de Tradingview a PRT?:
https://es.tradingview.com/v/b7o7GmWT/
Cycle1(i, waveThrottle, cycs) =>ret = 6.0*waveThrottle+1.0if (i==0)ret := 1.0+waveThrottleelse if (i==1)ret := 1.0+waveThrottle*5.0else if (i==(cycs-1))ret := 1.0+waveThrottleelse if (i==(cycs-2))ret := 1.0+waveThrottle*5.0retCycle2(i, waveThrottle, cycs) =>ret=-4.0*waveThrottleif (i==0)ret := -2.0*waveThrottleelse if (i==(cycs-1))ret := 0.0else if (i==(cycs-2))ret := -2.0*waveThrottleretCycle3(i, waveThrottle, cycs) =>ret = waveThrottleif (i==(cycs-1))ret := 0.0else if (i==(cycs-2))ret := 0.0retiWTT_CSI_processor(CycleCount) =>wtt1=0.0wtt2=0.0wtt3=0.0wtt4=0.0wtt5=0.0_wtt1=0.0_wtt2=0.0_wtt3=0.0_wtt4=0.0_wtt5=0.0momentum=0.0acceleration=0.0swing=0.0cycs=50waveThrottle=float(160*CycleCount)currentVal=0.0for i = 0 to cycs – 1 by 1swing:=Cycle1(i,waveThrottle,cycs)-wtt4*wtt1-_wtt5*_wtt2if(swing==0)breakmomentum := Cycle2(i,waveThrottle,cycs)_wtt1 := wtt1wtt1 := (momentum-wtt4*wtt2)/swingacceleration:=Cycle3(i,waveThrottle,cycs)_wtt2 := wtt2wtt2 := acceleration/swingcurrentVal:=(close[49-i]-_wtt3*_wtt5-wtt3*wtt4)/swing_wtt3 := wtt3wtt3 := currentValwtt4 := momentum-wtt5*_wtt1_wtt5 := wtt5wtt5 := accelerationcurrentValbanding(CRSI, Period, Leveling) =>var percent = Leveling / 100.0periodMinusOne = Period-1maxima = -999999.0minima = 999999.0for i=0 to periodMinusOnecrsi = nz(CRSI[i])if crsi > maximamaxima := crsielse if crsi < minimaminima := crsistepFactor = (maxima – minima) / 100.0float lowBand = nafor steps=0 to 100testValue = minima + stepFactor * stepsbelow = 0for m=0 to periodMinusOneif CRSI[m] < testValuebelow := below + 1if below/Period >= percentlowBand := testValuebreakfloat highBand = nafor steps=0 to 100testValue = maxima – stepFactor * stepsabove = 0for m=0 to periodMinusOneif CRSI[m] >= testValueabove := above + 1if above/Period >= percenthighBand := testValuebreak[highBand, lowBand]//==== Varsvar leveling = 10var cyclicMemory = 34//===== Calculationsthrust1=iWTT_CSI_processor(1)thrust2=iWTT_CSI_processor(10)CSIBuffer = thrust1-thrust2[highBand, lowBand] = banding( CSIBuffer, cyclicMemory, leveling)highband = plot(highBand, “HighBand”, color=color.aqua , editable=false)lowband = plot( lowBand, “LowBand”, color=color.aqua , editable=false)fill( highband, lowband, transp=90 , color=#CCCC77 )plot(0, color=color.black, linewidth=1, transp=25)plot(CSIBuffer, color=color.fuchsia, linewidth=1)06/11/2024 at 3:44 PM #233750Buenas! Aquí tienes el indicador.
Queda pendiente el módulo de divergencias. Con tanto bucle se hace muy lento el indicador…
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206//------------------------------------------------------------////PRC_Cycle swing momentum//version = 0//11.06.24//Iván González @ www.prorealcode.com//Sharing ProRealTime knowledge//------------------------------------------------------------////-----Inputs-------------------------------------------------//leveling = 10cyclicmemory = 34//------------------------------------------------------------////-----Thrust1 Calculation------------------------------------//CycleCount = 1wtt1=0.0wtt2=0.0wtt3=0.0wtt4=0.0wtt5=0.0pwtt1=0.0pwtt2=0.0pwtt3=0.0pwtt4=0.0pwtt5=0.0mom=0.0acceleration=0.0swing=0.0cycs=50waveThrottle=(160*CycleCount)currentVal=0.0ret1=0ret2=0ret3=0for i = 0 to cycs - 1 do//Cycle1(i,waveThrottle,cycs)ret1 = 6.0*waveThrottle+1.0if i = 0 thenret1 = 1+waveThrottleelsif i=1 thenret1 = 1+waveThrottle*5elsif i=cycs-1 thenret1 = 1+waveThrottleelsif i=cycs-2 thenret1 = 1+waveThrottle*5endifswing = ret1-wtt4*wtt1-pwtt5*pwtt2if swing = 0 thenbreakendif//Cycle2(i, waveThrottle, cycs)ret2 = -4.0*waveThrottleif i=0 thenret2 = -2.0*waveThrottleelsif i=(cycs-1)thenret2 = 0.0elsif i=(cycs-2) thenret2 = -2.0*waveThrottleendifmom=ret2pwtt1=wtt1wtt1=(mom-wtt4*wtt2)/swing//Cycle3(i, waveThrottle, cycs)ret3 = waveThrottleif i=cycs-1 thenret3 = 0elsif i=cycs-2 thenret3 = 0endifacceleration=ret3pwtt2=wtt2wtt2=acceleration/swingcurrentval = (close[49-i]-pwtt3*pwtt5-wtt3*wtt4)/swingpwtt3=wtt3wtt3=currentvalwtt4=mom-wtt5*pwtt1pwtt5=wtt5wtt5=accelerationnextthrust1 = currentval/////thrust2CycleCount2 = 10wtt12=0.0wtt22=0.0wtt32=0.0wtt42=0.0wtt52=0.0pwtt12=0.0pwtt22=0.0pwtt32=0.0pwtt42=0.0pwtt52=0.0mom2=0.0acceleration2=0.0swing2=0.0cycs2=50waveThrottle2=(160*CycleCount2)currentVal2=0.0for j = 0 to cycs2 - 1 do//Cycle1(i,waveThrottle,cycs)ret12 = 6.0*waveThrottle2+1.0if j = 0 thenret12 = 1+waveThrottle2elsif j=1 thenret12 = 1+waveThrottle2*5elsif j=cycs2-1 thenret12 = 1+waveThrottle2elsif j=cycs2-2 thenret12 = 1+waveThrottle2*5endifswing2 = ret12-wtt42*wtt12-pwtt52*pwtt22if swing2 =0 thenbreakendif//Cycle2(i, waveThrottle, cycs)ret22 = -4.0*waveThrottle2if j=0 thenret22 = -2.0*waveThrottle2elsif j=(cycs2-1)thenret22 = 0.0elsif j=(cycs2-2) thenret22 = -2.0*waveThrottle2endifmom2=ret22pwtt12=wtt12wtt12=(mom2-wtt42*wtt22)/swing2//Cycle3(i, waveThrottle, cycs)ret32 = waveThrottle2if j=cycs2-1 thenret32 = 0elsif j=cycs2-2 thenret32 = 0endifacceleration2=ret32pwtt22=wtt22wtt22=acceleration2/swing2currentval2 = (close[49-j]-pwtt32*pwtt52-wtt32*wtt42)/swing2pwtt32=wtt32wtt32=currentval2wtt42=mom2-wtt52*pwtt12pwtt52=wtt52wtt52=acceleration2nextthrust2=currentval2CSIBuffer = thrust1-thrust2//banding(CRSI, Period, Leveling)//banding(CSIBuffer,cyclicMemory,leveling)CRSI=CSIBufferPeriod=cyclicMemorypercent = leveling/100periodMinusone = period-1maxima = -999999.0minima = 999999.0for i=0 to periodMinusone do//crsi = crsi[i]if crsi[i] > maxima thenmaxima = crsi[i]elsif crsi[i] < minima thenminima = crsi[i]endifnextstepfactor = (maxima-minima)/100lowband = 0for steps=0 to 100 dotestvalue = minima+stepfactor*stepsbelow=0for m=0 to periodMinusone doif crsi[m]<testvalue thenbelow=below+1endifnextif below/period >= percent thenlowband = testvaluebreakendifnexthighband=0for steps=0 to 100 dotestvalue=maxima-stepfactor*stepsabove=0for m=0 to periodMinusone doif crsi[m]>=testvalue thenabove=above+1endifnextif above/Period >= percent thenhighband=testvaluebreakendifnextcolorbetween(highband,lowband,204,204,119,90)return CSIBuffer as "CSIBuffer" coloured(224,64,251)style(line,2), Lowband as "Lowband" coloured(0,188,212),highband as "Highband" coloured(0,188,212), 0 coloured("black") -
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)