Tester produces results but live falls over
Forums › ProRealTime English forum › ProOrder support › Tester produces results but live falls over
- This topic has 10 replies, 3 voices, and was last updated 8 years ago by Dymjohn.
-
-
07/18/2016 at 5:23 PM #10564
Hi Nicolas,
The attached code produces results with modest profit on the DAX but if I run in live mode on IG it fails to raise an order and stops running. It says to view reason for rejection but cannot see any failed orders on the report. Any suggestions please?
John
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081<br>// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivatedDEFPARAM FLATBEFORE = 070000 // Flat before this timeDEFPARAM FLATAFTER = 205000 // Flat after this time//reset a at start of dayonce a = 0//resetting variables when no trades are on marketif not onmarket thenMAXPRICE = 0MINPRICE = closepriceexit = 0endif//prices to enter tradesBuyPrice = High[0]+2*PointSizeSellPrice = Low[0]-2*PointSize// Conditions to enter long positionsindicator1 = Stochastic[14,5](close)c1 = (indicator1 < 25)indicator2 = Average[20](close)indicator3 = Average[50](close)c2 = (indicator2 > indicator3)c6 = (a<=0)IF NOT ONMARKET AND c1 AND c2 AND c6 THENBUY 1 PERPOINT AT BuyPrice STOPa=1//trade is a buy orderENDIF// Conditions to enter short positionsindicator5 = Stochastic[14,5](close)c4 = (indicator5 > 75)indicator6 = Average[50](close)indicator7 = Average[20](close)c5 = (indicator6 > indicator7)c7 = (a>=0)IF NOT ONMARKET AND c4 AND c5 AND c7 THENSELLSHORT 1 PERPOINT AT SellPrice STOPa=-1//trade is a sell orderENDIFtrailingstop = 20//resetting variables when no trades are on marketif not onmarket thenMAXPRICE = 0MINPRICE = closepriceexit = 0endif//case SHORT orderif shortonmarket thenMINPRICE = MIN(MINPRICE,low) //saving the MFE of the current tradeif tradeprice(1)-MINPRICE>=trailingstop*pointsize then //if the MFE is higher than the trailingstop thenpriceexit = MINPRICE+trailingstop*pointsize //set the exit price at the MFE + trailing stop price levelendifendif//case LONG orderif longonmarket thenMAXPRICE = MAX(MAXPRICE,high) //saving the MFE of the current tradeif MAXPRICE-tradeprice(1)>=trailingstop*pointsize then //if the MFE is higher than the trailingstop thenpriceexit = MAXPRICE-trailingstop*pointsize //set the exit price at the MFE - trailing stop price levelendifendif//exit on trailing stop price levelsif onmarket and priceexit>0 thenEXITSHORT AT priceexit STOPSELL AT priceexit STOPendif// stop and targetSET STOP PLOSS 25SET TARGET PPROFIT 8007/18/2016 at 6:38 PM #10566Hi. If you look in the Order list, under Cancelled/Rejected tab- find the order you ask about, and hover the mouse pointer over the yellow ! mark. it should give some more information.
\Elsborgtrading
07/19/2016 at 8:17 AM #10583Hi Elsborgtrading
The Cancelled/Rejected list is empty in fact the whole report is empty. When it fell over and having found no transactions I deleted the strategy from auto trading. I’m just going to reload and wait for it to fall over again. The pity was it tried to place the trade when I expected it to.
Thanks for your consideration of this problem.
07/19/2016 at 11:06 AM #10589Strange. My guess is that you didn’t have enough margin in you account to cover the trade- I ofcause could be wrong, but I know that happened for me a couple of times- or your code tried to enter the market at 1 position when you needed at least 2 for that instrument or something like that.There is a setting for Pro Order that is should stop or continue when encounter an error. hope that helps 🙂
I didn’t find anywhere in PRT to dispay the INFO of the instrument where you can see these settings, so I use the web trader instead to see this. see scrndump. Perhaps someone else knows where to see INFO in PRT?
07/19/2016 at 1:09 PM #10595Hi Elsborgtrading
I’m trading a spreadbet account but have more than enough in my account to open 3 points. My only question mark on this have I written the code correctly. On ititiation of the strategy I entered 3 as the quantity, is this consistent with the way I wrote the code i.e.
<pre class=”line-numbers language-prorealtime”><code class=” language-prorealtime”><span class=”token keyword”>SELLSHORT</span> <span class=”token number”>1</span> PERPOINT <span class=”token keyword”>AT</span> SellPrice <span class=”token keyword”>STOP
</span>or
<pre class=”line-numbers language-prorealtime”><code class=” language-prorealtime”><span class=”token keyword”>BUY</span> <span class=”token number”>1</span> PERPOINT <span class=”token keyword”>AT</span> BuyPrice <span class=”token keyword”>STOP
</span>The minimum bet on DAX is 2 points.
Regards
dymjohn07/19/2016 at 2:06 PM #10602Hi again. I’m not that experienced in coding, so I actually don’t know the one you just posted? Is that PRT code? anyway the first code you put in the initial post here, I tried to enter in Pro order and it backtest with no error, but I guess that you already knew that 🙂 But what DAX time frame are you using? I can’t back test any that actually makes a profit with the code?
Br. Elsborgtrading
07/19/2016 at 2:41 PM #1060407/19/2016 at 6:24 PM #10630Hi. Maybe I’m doing something wrong here, because I don’t see any profit- even with no spread setting?
07/19/2016 at 6:39 PM #1063407/20/2016 at 9:01 AM #1066807/20/2016 at 9:03 AM #10669 -
AuthorPosts
Find exclusive trading pro-tools on