add position at specific price
Forums › ProRealTime English forum › ProOrder support › add position at specific price
- This topic has 10 replies, 4 voices, and was last updated 5 years ago by
rama.
-
-
01/30/2020 at 8:59 AM #1182401x=close[1]
I want to buy when price cross over x+30, x+60, x+90 and so on only one contact at each price
I tried this code, but this is buying more than one contract a each price(when price retracement happens)
1234567if not onmarket thenbuy at close[1}+1 limitendifif onmarket thenbuy at tradeprice+30 stopendifwhat is the correct code to buy only contact at tradeprice+30 when price moves in my favour
01/30/2020 at 9:33 AM #118247It continuously buy new order because if your are already above the price you ask, the order is triggering automatically, so you have to check first if you are below the next +30 points step and place your pending order:
123if onmarket and close<tradeprice+30 thenbuy at tradeprice+30 stopendif01/30/2020 at 9:37 AM #11824801/30/2020 at 5:38 PM #11828801/31/2020 at 10:05 AM #1183311234567891011121314151617181920212223DEFPARAM CumulateOrders = true // Cumulating positions deactivated// Conditions to enter long positionsc1 = DHigh(0)-30c2 = DHigh(0)-60c3 = DHigh(0)-90c4 = DHigh(0)-120c5 = DHigh(0)-150c6 = DHigh(0)-180c7 = DHigh(0)-210c8 = DHigh(0)-240c22 = (close crosses under c1) or (close crosses under c2) or (close crosses under c3) or (close crosses under c4)c222 = (close crosses under c5) or (close crosses under c6) or (close crosses under c7) or (close crosses under c8)if not onmarket and c22 or c222 thensellshort at marketendifif onmarket and PositionPerf>= 0.001 and close<tradeprice-30 thensellshort at tradeprice(0)-30 stopendifI am running the above code now, I will update the results, I expect it to place only 1 order at 30 points rise on the market
01/31/2020 at 10:51 AM #11833401/31/2020 at 2:58 PM #118356I want to try only on
initial order at price x=0
then on x+30, x+60 etc
the problem I am facing is system by first at x =0
next orders is placed when price is crossing over x=30, then price come below x+30 and crosses over x+30 another other is placed
if want to place 4 orders
one order is placed at x=0
then the remaining at x+30 when price is crossed over x+30 the bear in mind that I am trading in 2 seconds time frame
01/31/2020 at 3:21 PM #118362It should never trade the same level because it always uses the last trade open price to place the next order at +30 points. It works, I just made the test.
123456789defparam cumulateorders=trueif not onmarket and close>close[1] thenbuy at marketendifif onmarket and close<tradeprice+30 thenbuy at tradeprice+30 stopendif01/31/2020 at 5:52 PM #118384seems to be skipping some order s12345678910111213141516171819202122232425262728293031323334353637383940414243//-------------------------------------------------------------------------// Main code : 111(4)//-------------------------------------------------------------------------c1 = DHigh(0)-25c2 = DHigh(0)-50c3 = DHigh(0)-75c4 = DHigh(0)-100c5 = DHigh(0)-125c6 = DHigh(0)-150c7 = DHigh(0)-175c8 = DHigh(0)-200c9 = DHigh(0)-225c10 = DHigh(0)-250c11 = DHigh(0)-275c12 = DHigh(0)-300c13 = DHigh(0)-325c14 = DHigh(0)-350c15 = DHigh(0)-375c16 = DHigh(0)-400c17 = DHigh(0)-425c18= DHigh(0)-450c19 = DHigh(0)-475c20 = DHigh(0)-500c21 = DHigh(0)-525c32 = DHigh(0)-550c33 = DHigh(0)-575c1000 = (close crosses over c20) or (close crosses over c21) or (close crosses over c32) or (close crosses over c33)or (close crosses over c19)c22 = (close crosses over c1) or (close crosses over c2) or (close crosses over c3) or (close crosses over c4)c222 = (close crosses over c5) or (close crosses over c6) or (close crosses over c7) or (close crosses over c8)c232 = (close crosses over c9) or (close crosses over c10) or (close crosses over c11) or (close crosses over c12)c233 = (close crosses over c13) or (close crosses over c14) or (close crosses over c15) or (close crosses over c16) or (close crosses over c17) or (close crosses over c18)if not onmarket and c22 or c222 or c232 or c233 or c1000 thenbuy at marketendifif onmarket and (close<tradeprice+25) or close[1]<tradeprice+25 thenbuy at tradeprice+25 stopendifset target profit 41.6code seems to be working partially, I have added the target profit 41.6 then it skipped some orders
01/31/2020 at 6:44 PM #118387You should check it visually on the price chart to understand why an order was not set at some steps.
I think that your condition is not correctly formatted, try with:
1GRAPH onmarket and (close<tradeprice+25 OR close[1]<tradeprice+25)02/05/2020 at 5:21 PM #118764code seems to be working fine, I want
want to close short or long potions after n points retrace , is this correct code1234567if longonmarket and couontofpoistion=3 thensellhort 2 contracts at tradeprice-n stopendifif shortonmarket and couontofposition=-3 thenbuy 2 contracts at tradeprice+n stopendif -
AuthorPosts
Find exclusive trading pro-tools on