Place orders when a curve change colour
Forums › ProRealTime English forum › ProOrder support › Place orders when a curve change colour
- This topic has 14 replies, 2 voices, and was last updated 7 years ago by Dave.
-
-
01/04/2017 at 8:47 AM #1977401/04/2017 at 9:04 AM #19775
@Dave
Yes of course, because there are conditions that make the curve change its colour, so you’ll use these conditions values instead of the colour changing itself.
In my example in this post, I use 2 conditions named “bullish” and “bearish”, you have to define them first, what is your definition of a bullish trend that make change the color of the curve?01/04/2017 at 9:35 AM #1978001/04/2017 at 9:46 AM #1978601/04/2017 at 8:21 PM #1986501/05/2017 at 9:43 AM #19898FYI, I moved your request to a fresh new topic in the appropriate part of the forum.
So, about your trading strategy, it can be coded like this (bullish side only):
123456789101112131415X = 10 //moving average periodtakeprofit = 30 //takeprofit in pointsstoploss = 60 //stoploss in pointsma = average[X](close)// the moving average is changing direction from bearish to bullishbullish = ma>ma[1] and ma[1]<ma[2]if not longonmarket and bullish thenbuy 1 share at marketendifset target pprofit takeprofitset stop ploss stoplossWith this code, the trade is not closed with a bearish signal (from green to red), but only with takeprofit or stoploss. But this is a good start to improve the strategy.
01/05/2017 at 2:50 PM #1993101/05/2017 at 8:41 PM #19969I dropped it on todays dax 15 chart and it took four nice trades (sl/tp reduced to 20 to see more triggers) ,could you clarify simply what line 8 means (I’m still only at ‘assisted creation’ level in logic terms!! 🙂 ), is this the reason the order is placed on the third candle after the ma has changed colour or does the indicator paint this back as it calculates?.
regards
Dave
01/05/2017 at 9:31 PM #1997601/05/2017 at 10:25 PM #1998001/05/2017 at 10:29 PM #1998101/05/2017 at 10:46 PM #1998201/18/2017 at 8:53 AM #21522Ok Nicolas, So if I understand correctly the line says bullish = ma greater than 1 period back and ma 1 period back is less than 2 periods back because at that point it was decreasing or bearish?.
You know where I’m going with this my friend, So if the ma was bullish turning bearish the the code should read :-
bearish = ma<ma[1] and ma[1]>ma[2]
01/18/2017 at 9:22 AM #2152502/01/2017 at 8:53 AM #23373OK, so here is a simple complete program with buy and sell conditions.It simply looks for a fast ma above a slow ma and places an order when the fast ma changes direction in agreement with slow ma.any ideas on improvements/filters/ma combinations etc most welcome.
dave
12345678910111213141516171819202122232425262728DEFPARAM CumulateOrders = False // Cumulating positions deactivatedDEFPARAM FLATBEFORE = 080000DEFPARAM FLATAFTER = 180000takeprofit = 5 //takeprofit in pointsstoploss = 10 //stoploss in pointsfastma = ExponentialAverage[11](close)slowma = ExponentialAverage[89](close)//fastma bullish and bearish conditionsfastbullish = fastma>fastma[1] and fastma[1]<fastma[2] and fastma>slowmafastbearish = fastma<fastma[1] and fastma[1]>fastma[2] and fastma<slowma//conditions for long = fast ma ABOVE slow ma and turning in agreement with slow ma trendif not longonmarket and fastbullish thenbuy 1 share at marketendif//conditions for short = fast ma BELOW slow ma and in agreement with slow ma trendif not shortonmarket and fastbearish thensellshort 1 share at marketendifset target pprofit takeprofitset stop ploss stoploss//set stop ptrailing 121 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on