Hi Traders,
This is my first post in the forum so let me introduce myself. I discovered the user friendly and creative PRT platform a couple of months ago and made the switch from the more frustrating MT4 platform, I have been trading FX along with commodity and index CFDs for over 7 years and picked up a few good strategies along the way, one which I am going to share and ask for help coding.
The strategy is based on scaling into positions while maintaining the same risk by placing stop orders in the direction of the trend and momentum of the selected instrument, for instance earlier this week I was anticipating that EUR/USD would drop and at the time the market price was 1.1385. I would start the system placing an order to sell 1 contract at market price along with several sell stop orders to sell additional contracts at predetermined intervals by 20 pips, 1.1365, 1.1345 and 1.1325 etc.
The key for the strategy is to maintain the same risk as more contracts are added to the position, starting with a 1% risk on the initial market order taken at 1.1385 with 1% risk equaling 100 pips with a stop loss at 1.1485, once the second order is filled at 1.1365 the 1% risk is maintained by the stop loss being moved automatically to 1.1425 (50 pips from the average price at 1.1375), once the third order is filled at 1.1345 the 1% risk is maintaned by the stop loss being moved automatically to 1.1398 (33 pips from the new average price at 1.1365) and on it goes until reaching the desired number of contracts, in my case most often 5-10 contracts. In a perfect world I would like to include a function to set the stop loss to break even once reaching a certain percentage of profit but I have not figured that part out yet…
If going for 5 contracts at 20 pip intervalls the first 100 pips yield a 3% return and evry additional 20 pips yield 1 additional percent, for instance given that pullbacks and whipsaws are moderate and do not cause an exit by the stop loss a 240 pip move yield a 10% profit with only 1% risk, I say that is pretty sweet R:R and MM 🙂
I already have the code to do this on the frustrating and not so reliable MT4 platform but can it be coded for PRT?
A few weeks ago I thought of course it can be done! Now I am a bit less convinced since I have made two requests to the inhouse ProRealTime programmers and been given two different sets of code but neither of them works as intended for my IG account so now I am asking all of you and in particular Nicolas if it es even possible to code this?
This is the first code provided by the PRT programmers;
stop1=round(close*1000)/1000
if stop1 <= close then
stop1=stop1+0.001
endif
tradesum=0
stop2=stop1+0.002
stop3=stop2+0.002
stop4=stop3+0.002
stop5=stop4+0.002
buy 1 share at stop1 stop
buy 1 share at stop2 stop
buy 1 share at stop3 stop
buy 1 share at stop4 stop
buy 1 share at stop5 stop
if longonmarket then
for i=0 to countoflongshares-1 do
tradesum=tradesum+tradeprice(i)
next
averagetrade=tradesum/countoflongshares
sell at averagetrade-((100/countoflongshares)*pointsize) stop
endif
And here is the second code;
DefParam CumulateOrders = True
Once firstPrice = undefined
// Change these settings accordingly
Once lotSize = 10
Once orderLimit = 5
Once pipInterval = 10
Once profitPercentage = 0.2
Once lossPercentage = 0.5
If CountofLongShares[1]=0 and CountofLongShares=lotSize then
firstPrice = TradePrice
Elsif CountOfLongShares>lotSize then
Sell At firstPrice Stop
Endif
If Not LongOnMarket then
Buy lotSize Lots At Market
Elsif CountOfLongShares<orderLimit*lotSize then
Buy lotSize Lots At TradePrice+pipInterval*PointValue Stop
Endif
Set Target %Profit profitPercentage
Set Stop %Loss lossPercentage
In the first code the SL function seemed to be working fine but not the order placement which tended to place all orders virtually instantly at the same price, in second code the orders were sometimes place at the proper intervalls and sometimes at the same price as a previous order.
Please help me figure this out, I look forward to any replies and assistance!
Regards, Filip