Need help with automatic a strategy for DAX and SA40
Forums › ProRealTime English forum › ProOrder support › Need help with automatic a strategy for DAX and SA40
- This topic has 16 replies, 5 voices, and was last updated 4 years ago by Paul.
-
-
08/22/2019 at 9:06 AM #105257
Good day
I am looking for someone that can help me to code a automatic strategy.. it is a very simple strategy which i use on a daily basis but i want to automate it.. I have no
coding experience so thats why i need someone that can help me please.
Thanks
08/22/2019 at 9:07 AM #10525808/22/2019 at 9:17 AM #105259Thank you for the reply..
The rules are- for south african 40 and dax on 15 min chart
Markets open at 9 am my time: There is a candle that forms 8:45 to 9:00.
At exactly 9 am I want to place a buy stop above the high and a sell stop below the low of the 8:45 candle.
When one order is triggered the other must be canceled.Stop loss must be adjustable and that i will test once i can do back testing.
Tp must also be adjustable.A second option must also be available to add another trade at example 50 points from first entry. Like hedging but i will also test it first.
So basically breakout of 8:45 candle with adjustable sl and tp. Contracts must also be adjustable 1 or 2 or 5 contracts ect..
Hope it is clear
Thank you
08/22/2019 at 10:10 AM #105264Hi
IS there a way to contact you via a message system or how can we talk if there are any questions?
Thanks
08/22/2019 at 10:20 AM #105269Lombard974 – Do not double post as it just wastes the time of those trying to help you and leads to confusion – especially if you double post in the wrong forums! Both Roberto and I have had to waste time moving and deleting your posts this morning. Double posting does not get you a faster or better answer – in fact it does the opposite!
08/22/2019 at 10:24 AM #105270If you want to place two pending orders and cancel one when the other is filled then you will need to use MTF on a very fast time frame which will massively limit your back test data available to test on.
Hedging is not possible in PRT as you cannot have a strategy both long and short at the same time. You would need two strategies and simulate the other strategy in each. There would however be some inaccuracy in prices as the fill price is not always the same as the close or open price that you would be simulating with.
08/22/2019 at 10:31 AM #105272Hi Vonasi
Sorry its my first time using the forum and i dont know exactly how to reply.. sorry for that. What i mean with hedging and maybe its not the right term.. If for example my sell order is triggered at that specific time buy stop is canceled and another sell stop order is placed 50 points below my entry.. if prices goes doen further it triggers the second sell.. so i have 2 short trades running with same tp.
I hope it is clear?
Thanks
08/23/2019 at 4:55 PM #105408Something like this will mean that your buy order is cancelled after 1 second if your sell order is hit. It then sends a pending order every second to the market 50 pips from your entry price until that is filled.
1234567891011121314151617181920timeframe(daily)longlevel = high[1] //long entry price - yesterdays high in this example.shortlevel = low[1] //short entry price - yesterdays low in this example.timeframe(1 second)if not onmarket thenbuy 1 contract at longlevel stopsellshort 1 contract at shortlevel stopendifif countofposition = 1 thenbuy 1 contract at tradeprice + 50 stopendifif countofposition = -1 thensellshort 1 contract at tradeprice - 50 stopendif08/25/2019 at 6:25 PM #105528Hi
Thank you for the reply.. is this the complete code for my strategy i want to implement? How do i change code for 15 min time frame?
I am trying to read up in the documentation but dont know how to put it all together.
Can you please help me with the complete code?
Than you
08/25/2019 at 7:39 PM #105530No this is not a complete strategy. It is just showing how you can send long and short pending orders to the market and cancel one if the other is filled – and then to allow a second position to be entered once the first is opened.
08/25/2019 at 7:51 PM #105531Is it possible you can help with the complete code? I am trying but just getting errors.. I have no idea what i am doing.
thank you
08/26/2019 at 12:35 AM #105539Is it possible you can help with the complete code?
I’m busy with other stuff tomorrow and then flying back to Greece the next day so time is a bit short at the moment. Perhaps someone else can help as it is only adding stoploss and take profit and adding some trading times in? You may need to give more detail such as do you want the TP and SL levels to be at the same levels for the added positions as for the first positions etc.
Be aware as I said before that to have one order cancel another order means that you have to use the 1 second time frame and so worthwhile back testing is going to be pretty hopeless due to the limited data sample in the 1 second time frame.
08/26/2019 at 10:47 AM #105562Hi Lombard974, I am sure I can assist you with the coding if you are looking for more comprehensive assistance: http://www.FXautomate.com
08/26/2019 at 4:25 PM #1055931234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071DEFPARAM CumulateOrders = falseDEFPARAM FLATBefore = 084500 //09:00DEFPARAM FLATAfter = 210000 //21:00DEFPARAM PreLoadBars = 2000ONCE nLots = 5ONCE MaxPrice = 999999ONCE MinPrice = 0ONCE FirstHour = 090000IF time = FirstHour THENMaxPrice = highest[3](high) //Il massimo/minimo delle ultime 12 barreMinPrice = lowest[3](low) // (ogni ora = 12 barre da 5 minuti)ENDIF//************************************************************************// trailing stop functiontrailingstart = 20 //5 trailing will start @trailinstart points profittrailingstep = 50 //5 trailing step to move the "stoploss"////reset the stoploss valueIF NOT ONMARKET THENnewSL=0ENDIF//manage long positionsIF LONGONMARKET THEN//first move (breakeven)IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THENnewSL = tradeprice(1)+trailingstep*pipsizeENDIF//next movesIF newSL>0 AND close-newSL>=trailingstep*pipsize THENnewSL = newSL+trailingstep*pipsizeENDIFENDIF//manage short positionsIF SHORTONMARKET THEN//first move (breakeven)IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THENnewSL = tradeprice(1)-trailingstep*pipsizeENDIF//next movesIF newSL>0 AND newSL-close>=trailingstep*pipsize THENnewSL = newSL-trailingstep*pipsizeENDIFENDIF//stop order to exit the positionsIF newSL>0 THENSELL AT newSL STOPEXITSHORT AT newSL STOPENDIF//************************************************************************// LONGa1 = price1 CROSSES OVER MaxPriceIF a1 THENBuy nLots CONTRACT AT MARKETMaxPrice = 999999MinPrice = 0ENDIF// SHORTb1 = price2 crosses under MinPriceIF b1 THENSellshort nLots CONTRACT AT MARKETMaxPrice = 999999MinPrice = 0ENDIFprice1 = TotalPrice > maxpriceprice2= TotalPrice < minpriceENDIFHello
I treid to modify this code i fund in the forum.. To enter the trade when it breaks the high or the low of the previous bar and not to wait for the close first. I am trying to define the price to break the highest or lowest of the MAXPRICE an MINPrice but dont know how to do it. Can you please assist me to fix it,
Thanks
08/26/2019 at 4:36 PM #105595I dont know how to set it up so that it uses a sl… Because the trailing stop works but sometimes the trade goes into negative from the start and then it doesnt close for a long time or until account is empty.
-
AuthorPosts
Find exclusive trading pro-tools on