TradingView
Daveatt
22 de Jul de 2019 16:08

How to connect your indicator with the Trade Manager Educacional

Bitcoin / U.S. dollarBitstamp

Descrição

Hi everyone

On Today's tutorial, I wanted to highlight how you can upgrade your own indicator to work with the Trade Manager
Let's take the dummy example of the double MM cross

Step 1 - Update your indicator

Somewhere in the code you'll have a LONG and a SHORT condition. If not, please go back to study trading for noobs (I'm kidding !!!)
So it should look to something similar

macrossover = crossover(MA1, MA2)
macrossunder = crossunder(MA1, MA2)

What you will need to add at the very end of your script is a Signal plot that will be captured by the Trade Manager. This will give us :

// Signal plot to be used as external
// if crossover, sends 1, otherwise sends -1
Signal = macrossover ? 1 : macrossunder ? -1 : na
plot(Signal, title="Signal")

The Trade Manager engines expects to receive 1 for a bullishg signal and -1 for bearish .

Step 2 - Add the Trade Manager to your chart and select the right Data Source

I feel the questions coming so I prefer to anticipate :) When you add the Trade Manager to your chart, nothing will be displayed. THIS IS NORMAL because you'll have to select the Data Source to be "Signal"
Remember our Signal variable from the Two MM Cross from before, now we'll capture it and.....drumb rolll...... that's from that moment that your life became even more AWESOME

The Engine will capture the last signal from the MM cross or any indicator actually and will update the Stop Loss, Take Profit levels based on the parameters you set on the Trade Manager

I worked the whole weekend on it because I wanted to challenge myself and give you something that I will certainly use in my own trading
Please send me some feedback or questions if any

Enjoy
Dave

Comentário

I've been asked to give the full 2 MM cross Signal script
You'll find it between the ///////////

//////////////////////////////////////////

//@version=3
//author=@Daveatt/David Attias

study("Two SMA Cross (Signal version)", shorttitle="Two SMA cross", overlay=true)

length_ma1 = input(7, title = "MA 1", type=integer, step=1, minval=2)
length_ma2 = input(10, title = "MA 2", type=integer, step=1, minval=2)

MA1 = sma(close, length_ma1)
MA2 = sma(close, length_ma2)

macrossover = crossover(MA1, MA2)
macrossunder = crossunder(MA1, MA2)

// Plots the crosses
plotshape(macrossover, title='MA Crossover', style=shape.circle, location=location.belowbar, size=size.normal, color=green, textcolor=black, text="MA Cross", transp = 0)
plotshape(macrossunder, title='MA Crossunder', style=shape.circle, location=location.abovebar, size=size.normal, color=red, textcolor=black, text="MA Cross", transp = 0)

// Signal plot to be used as external
// if crossover, sends 1, otherwise sends -1
Signal = macrossover ? 1 : macrossunder ? -1 : na
plot(Signal, title="Signal")

///////////////////////////////////////
Comentários
ekkutlu
Hi, I didn't find anywhere
macrossover = crossover(MA1, MA2)
macrossunder = crossunder(MA1, MA2)
On code.. For completing step 1...
Daveatt
@ekkutlu, Hi
This was a dummy example, I can give the code here no pb
it could be based on a 2 Moving Average Cross like that one

//@version=3
//author=@Daveatt/David Attias

study("Two SMA Cross (Signal version) V2", shorttitle="2 SMA cross V2", overlay=true)

length_ma1 = input(7, title = "MA 1", type=integer)
length_ma2 = input(10, title = "MA 2", type=integer)

MA1 = sma(close, length_ma1)
MA2 = sma(close, length_ma2)

macrossover = crossover(MA1, MA2)
macrossunder = crossunder(MA1, MA2)

// Plots the crosses
plotshape(macrossover, title='MA Crossover', style=shape.circle, location=location.belowbar, size=size.normal, color=green, textcolor=black, text="MA Cross", transp = 0)
plotshape(macrossunder, title='MA Crossunder', style=shape.circle, location=location.abovebar, size=size.normal, color=red, textcolor=black, text="MA Cross", transp = 0)

// Signal plot to be used as external
// if crossover, sends 1, otherwise sends -1

// SIGNAL PARAMETER HEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEERE

Signal = macrossover ? 1 : macrossunder ? -1 : na
plot(Signal, title="Signal")

Then add that one to your chart, and the Trade Manager.

Step 2
So once you did the Step 1, and apply your indicator and Trade manager to your chart, open the Trade Manager, and change the first parameter from "close" to "Signal" (assuming you called the plot from your indicator Signal as I suggested)
Please let me know here if it worked
Daveatt
@ekkutlu, I also posted the source code as an update here

Hope you'll manage to make the Trade Manager to work fine now
devinmorell2020
your trade manager script doesnt work. there is no source drop down.
itslukino
it doesn't work and I cannot open the code to apply the mods u mentioned. please advise
Daveatt
@prodefender1980, I removed the indicator because I had some bugs to fix and updates to code. I said it on the indicator page itself. Sorry for the inconvenience. I'll republish in a few weeks when ready
itslukino
@Daveatt, brilliant! thanks so much! masterpiece...looking forward to try
Ace567890
Awesome. I've been on Tradinview for a while an this is the first time I have seen this. You share so much information. What versions of trade manager is this available?
Daveatt
@Ace567890, I feel stupid that I didn't precise it on the description of this post ...
That one tradingview.com/script/rU1uGnt7-Trade-Manager/ It's the standalone Trade Manager meaning it works by itself once connected to another indicator
Mais