again a question to the pivot
Forums › ProRealTime English forum › ProOrder support › again a question to the pivot
- This topic has 7 replies, 2 voices, and was last updated 2 years ago by f1_maik.
-
-
03/15/2022 at 4:51 PM #190024
again, a question to the pivot.
Sometimes I scare myself with how little my programming skills are.I would like to do the following on a daily basis:
Once the pivot points are known (00.00?) open a trade that has the target the pivot point.
For the calculation of the pivot for Monday, the data from Friday should be taken.How do I program this correctly?
A big thank you in advance
03/15/2022 at 5:49 PM #190026There you go:
123456789101112131415161718192021222324252627282930DEFPARAM CumulateOrders = False//// Predefined PRT calculation (H+L+C)/3//p = 1IF OpenDayOfWeek = 1 THENp = 2ENDIFPivt = (DHigh(p) + DLow(p) + DClose(p))/3 // - Pivot//Res4 = (2 * Pivt) + Dhigh(p) - (3 * Dlow(p)) //Res4//Res3 = DHigh(p)+(2*(Pivt-DLow(p))) //Res3//Res2 = Pivt+(DHigh(p)-DLow(p)) //Res2//Res1 = (2*Pivt) - DLow(p) //Res1//Sup1 = (2*Pivt) - DHigh(p) //Sup1//Sup2 = Pivt-(DHigh(p)-DLow(p)) //Sup2//Sup3 = DLow(p)-(2*(DHigh(p)-Pivt)) //Sup3//Sup4 = (2 * Pivt) + Dlow(p) - (3 * Dhigh(p)) //Sup4//MidR1 = (3*((DHigh(p) + DLow(p) + DClose(p))/3)-DLow(p))/2 //MidR1//MidR2 = 3*(((DHigh(p) + DLow(p) + DClose(p))/3)+DHigh(p))/2-DLow(p) //MidR2//MidR3 = DHigh(p)+3*(((DHigh(p) + DLow(p) + DClose(p))/3)-DLow(p))/2 //MidR3//MidS1 = (3*((DHigh(p) + DLow(p) + DClose(p))/3)-DHigh(p))/2 //MidS1//MidS2 = 3*(((DHigh(p) + DLow(p) + DClose(p))/3)-DLow(p))/2-DHigh(p) //MidS2//MidS3 = DLow(p)+3*(((DHigh(p) + DLow(p) + DClose(p))/3)-DHigh(p))/2 //MidS3IF close > Pivt THENBUY 1 CONTRACT AT MarketSET TARGET pPROFIT abs(close - Pivt)ELSIF close > Pivt THENSELLSHORT 1 CONTRACT AT MarketSET TARGET pPROFIT abs(close - Pivt)ENDIF1 user thanked author for this post.
03/15/2022 at 5:59 PM #190029Sorry, in line 24 the “>” relational operator should be replaced by “<“.
Actually you did not tell when to enter Long or Short, so I just guessed.
1 user thanked author for this post.
03/16/2022 at 8:46 AM #19004903/20/2022 at 11:52 AM #190191Hello .
I had to deal with other things the whole days and only now got to look at the code.
I have rewritten the code a bit, simplified it a bit.
It looks like if set cumulateorders = true, the TP is cleared and set new each day. How can I change this?Pivt12345678910111213141516171819202122232425262728293031DEFPARAM CumulateOrders = truep = 1IF OpenDayOfWeek = 1 THENp = 2ENDIFPivt = (DOpen(p) + DHigh(p) + DLow(p) + DClose(p))/4 // - Pivot//Res4 = (2 * Pivt) + Dhigh(p) - (3 * Dlow(p)) //Res4//Res3 = DHigh(p)+(2*(Pivt-DLow(p))) //Res3//Res2 = Pivt+(DHigh(p)-DLow(p)) //Res2//Res1 = (2*Pivt) - DLow(p) //Res1//Sup1 = (2*Pivt) - DHigh(p) //Sup1//Sup2 = Pivt-(DHigh(p)-DLow(p)) //Sup2//Sup3 = DLow(p)-(2*(DHigh(p)-Pivt)) //Sup3//Sup4 = (2 * Pivt) + Dlow(p) - (3 * Dhigh(p)) //Sup4//MidR1 = (3*((DHigh(p) + DLow(p) + DClose(p))/3)-DLow(p))/2 //MidR1//MidR2 = 3*(((DHigh(p) + DLow(p) + DClose(p))/3)+DHigh(p))/2-DLow(p) //MidR2//MidR3 = DHigh(p)+3*(((DHigh(p) + DLow(p) + DClose(p))/3)-DLow(p))/2 //MidR3//MidS1 = (3*((DHigh(p) + DLow(p) + DClose(p))/3)-DHigh(p))/2 //MidS1//MidS2 = 3*(((DHigh(p) + DLow(p) + DClose(p))/3)-DLow(p))/2-DHigh(p) //MidS2//MidS3 = DLow(p)+3*(((DHigh(p) + DLow(p) + DClose(p))/3)-DHigh(p))/2 //MidS3If time = 080000 thenIf close < Pivt thenbuy at marketEndifEndifSET TARGET pPROFIT abs(close - Pivt)set stop %loss 1003/20/2022 at 12:11 PM #19019203/20/2022 at 12:15 PM #190193Nope, when accumulating positions an average price is calculated at any new position taken and TP and SL are adjusted accordingly.
This cannot be changed.
1 user thanked author for this post.
03/20/2022 at 1:52 PM #190198 -
AuthorPosts
Find exclusive trading pro-tools on