Help with Psosition perf( money mangement)
Forums › ProRealTime English forum › ProOrder support › Help with Psosition perf( money mangement)
- This topic has 4 replies, 3 voices, and was last updated 7 years ago by Kenneth Kvistad.
Viewing 5 posts - 1 through 5 (of 5 total)
-
-
07/10/2017 at 7:48 PM #40291
Hi..
Can someone help me with the code I paste to make it by 3 contracts every time after a win and make it buy 1 contract after every loss.
Lets say I loose 1 time I whant so short down to 1 contract until it wins the first time , then I whant it to by 3 contracts everytime as long as it wins until it looses again.
After every loss=1 contract until first win
After every win=3 contracts until first loss
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556defparam cumulateorders = falseav1 = average[3](close)av2 = average[20](close)av3 = average[50](close)x = 0.5bull = close> av1 and close >av2 and close > av3bear = close <av1 and close <av2 and close <av3//n= 1hammerup = min(open[1],close[1])>high[1]-(high[1]-low[1])/3 //and timeokhammerupnegated= max(open,close)<min(open[1],close[1]) and abs(open-close)/(high-low)>xcs = hammerup and hammerupnegated and bearhammerdown = max(open[1],close[1])<low[1]+(high[1]-low[1])/3 //and timeokhammerdownnegated = min(open,close)>max(open[1],close[1]) and abs(open-close)/(high-low)>xcl = hammerdown and hammerdownnegated and bullif cs thensellshort 2 contract at marketendifif cl thenbuy 2 contract at marketendif//TRAILING STOPTGL =30//32TGS= 20//32if not onmarket thenMAXPRICE = 0MINPRICE = closePREZZOUSCITA = 0ENDIFif longonmarket thenMAXPRICE = MAX(MAXPRICE,close)if MAXPRICE-tradeprice(1)>=TGL*pointsize thenPREZZOUSCITA = MAXPRICE-TGL*pointsizeENDIFENDIFif shortonmarket thenMINPRICE = MIN(MINPRICE,close)if tradeprice(1)-MINPRICE>=TGS*pointsize thenPREZZOUSCITA = MINPRICE+TGS*pointsizeENDIFENDIFif onmarket and PREZZOUSCITA>0 thenEXITSHORT AT PREZZOUSCITA STOPSELL AT PREZZOUSCITA STOPENDIFSET STOP ploss 110////120//120SET TARGET pPROFIT 52//5007/11/2017 at 8:08 AM #4031407/11/2017 at 8:28 AM #40318Sorry Nicolas.
I will remember this.
What is the right forum?
- Should I post it under Fransisco78’s tradingstrategy post?
07/11/2017 at 8:38 AM #40321I guess something like this should do it:
123456789101112131415NbrContracts = 2 //need a value for the first tradeIF PositionPerf(1) < 0 THENNbrContracts = 1ENDIFIF PositionPerf(1) > 0 THENNbrContracts = 3ENDIFif cs thensellshort NbrContracts contract at marketendifif cl thenbuy NbrContracts contract at marketendif07/11/2017 at 8:49 AM #40325Thanx tob107
I will try this later today.
Tried something simular yesterday but used ordersize insted of nbrcontracts:-)
- Should I post it under Fransisco78’s tradingstrategy post?
-
AuthorPosts
Viewing 5 posts - 1 through 5 (of 5 total)