Calling conditions from indicator
Forums › ProRealTime English forum › ProOrder support › Calling conditions from indicator
- This topic has 20 replies, 4 voices, and was last updated 3 years ago by umebon.
-
-
04/07/2021 at 7:31 AM #166363
Cant get the system to call this indicators (c11,c12,c13), what is wrong? I dont use any timeframes.
Indicator123456c11 = close > average[50](close)ma1 = average[18](close)c12 = ma1 > ma1[1]c13 = close > ma1return c11 AS "c11", c12 AS "c12", c13 AS "c13"System1234567c11, c12, c13 = CALL "Indicator"TaPosition = c11 AND c12 AND c13IF TaPosition THENBUY positionStorlek CONTRACT AT MARKETENDIF04/07/2021 at 8:22 AM #166366What’s wrong with it?
Apart from positionStorlek, that I replaced with 1, it works. You may have many positions being accumulated which never exit.
Try adding OnMarket as a condition and TP & SL:
123456789c11, c12, c13 = CALL "Indicator"TaPosition = c11 AND c12 AND c13IF TaPosition and not onmarket THENBUY 1 CONTRACT AT MARKETENDIFset target pprofit 100set stop ploss 10004/07/2021 at 9:01 AM #166376I have tried this but it doesnt take any positions, does it work for anyone?
DAXLv3_indicator123456c11 = close > average[50](close) // För att öppna lång positionma1 = average[18](close)c12 = ma1 > ma1[1] // För att öppna lång positionc13 = close > ma1 // För att öppna lång positionreturn Datum AS "Datum", c11 AS "c11", c12 AS "c12", c13 AS "c13"System123456789c11, c12, c13 = CALL "DAXLv3_indicator"TaPosition = c11 AND c12 AND c13IF TaPosition and not onmarket THENBUY 1 CONTRACT AT MARKETENDIFset target pprofit 100set stop ploss 10004/07/2021 at 9:08 AM #166377Have you enough units on you chart?
04/07/2021 at 9:14 AM #16637804/07/2021 at 9:54 AM #166380does it work for anyone?
Works for me … see attached, spread = 5.
I tweaked slightly re TP and TS and added cumulate orders = False, but it worked anyway straight out of the box … with no tweaks.
Be good if you can get it to take profitable shorts also?
1 user thanked author for this post.
04/07/2021 at 10:13 AM #16638504/07/2021 at 10:32 AM #16639004/07/2021 at 11:45 AM #166399This is how I would go about it (DJ 5min, spread = 2.4)
1234567891011121314151617181920// Definition of code parametersDEFPARAM CumulateOrders = false // Cumulating positions deactivatedDEFPARAM preloadbars = 5000//Tradetime = time >=143000 and time <210000// UK timeTradetime = time >=153000 and time <220000// Euro timepositionsize= 1c11 = close > average[50](close) // För att öppna lång positionma1 = average[18](close)c12 = ma1 > ma1[1] // För att öppna lång positionc13 = close > ma1 // För att öppna lång positionTaPosition = c11 AND c12 AND c13IF Tradetime and TaPosition and not onmarket THENBUY positionsize CONTRACT AT MARKETENDIFset target %profit 1.2set stop %loss 0.41 user thanked author for this post.
04/07/2021 at 11:59 AM #16640304/07/2021 at 12:03 PM #166404Using CALL tends to slow down your backtest. Faster to just code it into your system – then it’s all there to be optimized.
04/07/2021 at 12:06 PM #166405I have tried this but it doesnt take any positions
Where is Datum in your Indicator code?
1return Datum AS "Datum",04/07/2021 at 12:39 PM #166407123456789101112Datum = 1IF OpenDate > 20210501 THEN //Stoppdatum i majDatum = 0 //Invalidera alla signalerENDIF// Variablar till systemetc11 = close > average[50](close) // För att öppna lång positionma1 = average[18](close)c12 = ma1 > ma1[1] // För att öppna lång positionc13 = close > ma1 // För att öppna lång positionreturn Datum AS "Datum", c11 AS "c11", c12 AS "c12", c13 AS "c13"04/07/2021 at 12:48 PM #166408Using CALL tends to slow down your backtest. Faster to just code it into your system – then it’s all there to be optimized.
But if I want to hide some code for renting that is the only way?
04/07/2021 at 12:50 PM #166409Datum was not shown in the Indicator on the post I quoted above, nor therefore on the code I used and posted results for.
Surely the reason you are not getting trades is because it is not 1 May 2021 (20210501) yet?
You’ve been excluded from trading by your own code!? 🙂
1234Datum = 1IF OpenDate > 20210501 THEN //Stoppdatum i majDatum = 0 //Invalidera alla signalerENDIF -
AuthorPosts
Find exclusive trading pro-tools on