so hello again my name is pranit and Welcome to our trading view P skript Series in this video we're going to build and back test a trading strategy with the don't chain Channel indicator so we can see we have achieved a net profit of 25% total close trates are 388 profit factor is 1.3 and the Max draw down is only 15% so this is the trading strategy that we have built and I'm going to share it right now so before we start with the strategy let me just quickly explain the membership that we are offering so you're going to get lifetime access to all of our courses you're going to get lifetime access to our Advanced trading indicators as well as you're going to get lifetime access to Advanced back tested trading strategies you can see the program overview over here the link is in the description and you're also going to get four amazing bonuses which includes trading filters to improve your trading strategies Cod efforts for easy coding exclusive access to trading insights backed by back test evidence and the last bonus you're going to get various strategy templates which is going to help you to back test strategy strategies very easily the cost of this membership program is 1 120,000 but you're only going to get it for $4,999 so definitely check this page out the link is in the description so now let us start with the strategy part all right so now let us start with the coding part so in this strategy we're going to use donen Channel and the EMA indicator so the first thing that we have to create is the user inputs so DCL is equals to input. int default value I'm going to give it as 21 and title as DC L okay then we have the user inputs for the EMA so over here the user inputs will be SEMA L and FEMA is equals to uh one second here we go and then I'm going to create the user inputs for the EMAs so over here we will have 13 34 and 100 and then over here it will be scml length longl length and the feml length all right next thing that we're going to have is the trading indicator so so we have to build em indicator and the Don Channel indicator right so to create the Don Channel indicator I'm going to use T highest and t. lowest function so upper band is equals to ta do highest high of the last X periods so the period that we want is 21 so I'm going to keep DC length over here okay and then lower band is equals to da do lowest low of the last 21 periods and then D Channel also consist of a middle line which is nothing but the average of these two basis is equals to math. average of the upper band and the lower band so it will be adding these values and then it will divide by two all right as simple as that and the next we have is the buy and short rules so byy is equals to TA do crossover so we want the breakout of the highest high of the last 21 periods right so ta do crossover of close or you can keep it as high so T crossover of close and the upper band so the upper band will be the previous value of the upper band so I'm going to use a history referencing operator and then over here it will be short ta do cross under of close lower band and then history referencing operator okay and then we have the cell so we are going to exit with we are going to enter with donin Channel and we are going to exit with the EMAs so I have not created the EMA indicator let me create it so EMA 1 is equal to t. EMA close andema which is 13 EMA then I'm just going to copy and paste this here we go EMA 2 and EMA 3 and then here it will be Lema and FEMA here. cross under of SCA which is nothing but our 13 EMA and 34 EMA so EMA 1 and EMA 2 and then cover is equals to TA do crossover of EMA 1 and ema2 and there is one more and the close should be greater than the ema3 which is nothing but our 100 EMA and close should be greater than ema3 over here it will be less than ema3 so 100 EMA is going to be acting as a trend filter so if the prices are above the 100 EMA they're only going to take long signals and if the prices are below the 100 em we only going to take short signals all right as simple as that and the next thing we have is the strategy functions so if by strategy. entry ID as long direction as strategy. long comment as long okay and then over here it will be if cell so we have to close our long position right so strategy close ID as long and then command t byy Exit all right and then if short strategy do entry ID as short direction as strategy Dosh and comment as short okay and then if cover strategy. close one second ID as short and short exit all right and now I'm going to plot the D Channel as well as the EMAs so over here you're going to plot the indicator so plot D Channel which is upper band and then I'm going to copy and paste this quickly so upper band lower band and the bases and then uh over here the color will be color. white color do green over here it will be color dot red and over here it will be color dot white all right and now for the EMAs so we have three EMAs right 13 34 and 100 so over here it will be EMA 1 EMA 2 and EMA 3 okay so I'm going to give any random color orange lime and then uh Aqua okay so just let me increase the line width of this to three so now as we are done with the coding part oh here we have the strategy let me keep the initial Capital as 2 LS here we go let me save it again and now let me add it to the chart and you can see right this is the indicator so the orange line is nothing but 13 EMA green line is 34 EMA Aqua line is the 100 EMA this is the upper band this is the lower band and the middle line that you see over here is nothing but the bases all right so now uh as you can see right over here the prices are breaking out of the D channel that means the prices are creating a new high right the prices are creating a new high therefore we have a long over here and we exit our long position when the 13 EMA crosses below the 34 EMA as simple as that so we enter over here and we exit over here so can you see the orange line is crossing below the 34 EMA so this is the example for long and now let just cover an example for short so can you see over here at this candle the prices are breaking the D Channel lower band So once this candle is closed we're going to enter into a short position and we exit with the EMA crossover so at this point you can see the orange line which is nothing but the 13 EMA has crossed above the 34 EMA so we enter over here and we exit over here and this is an amazing move you can see that we got all right so basically we're capturing Trend breakouts with this particular indicator so now as we have verified the signals let's just go to the strategy tester and see the back test results so over here you can see this is the equity curve uh but we have not kept commission so let me keep it commission 0.02 and you can see net profit is to 45% draw down is near to 15% profit factor is also above one so this is the strategy if we go to Performance summary you can see Longs are generating 185% return and shorts are generating 60% return so obviously Longs are working well the historical back test data is from 2018 so almost 5 to 6 years and you can see these are the results so obviously we can hide the short signals as well by creating a long and short only filter so if I go to Pine editor right and if I just comvert this out you can see this will be the strategy results we have a smoother Equity curve and the draw down is near to 22% okay but I'm going to keep the short signals as it is and you can see these are the results with the long and short signals all right so basically this is it with the D Channel Trend trading strategy and if you also want to build this kind of trading strategies do check our pin script course out the link is in the description and if you have any queries regarding our pin script course you can always reach us on our WhatsApp business number and if you need the strategy just text us on our WhatsApp business number and will make sure that the strategy gets to you and also remember that I've have coded dat reading strategies fullback reading strategies as well as swing trading strategies the link of all those videos will be in the description so make sure to check those videos out if you like this video please subscribe because when you subscribe it gives us more motivation to create more meaningful videos and also let me know in the comment section below what you think about this trading strategy so thank you so much for watching and I will see you in the next video