Profit Target and Break Even

Questions about MultiCharts and user contributed studies.
tony
Posts: 420
Joined: 14 Jun 2013
Has thanked: 30 times
Been thanked: 81 times
Contact:

Profit Target and Break Even

Postby tony » 25 Sep 2013

I see the functions but for the life of me cannot find out how to use them. I am trying to simply set a profit target and then when reached set a stop to break even.

For example if the profit target reaches 100 to then set a stop at break even. I tried doing this with variables but they recalculate, conditionals are no longer true and the stop is cancelled.

I assume I use SetProfitTarget and / or SetBreakEven functions but don't know how to specify the profit target. It looks like using SetProfitTarget will actually exit the position via a market order once it is reached. I want to instead set a stop to breakeven once the profit target is reached.

Thank You -

User avatar
furytrader
Posts: 354
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Re: Profit Target and Break Even

Postby furytrader » 26 Sep 2013

As others have pointed out on previous occasions, you don't want to use the setProfitTarget, setStopLoss and setBreakEven commands within conditional statements. Instead, you should set them once within your code and that's it.

Also note that setProfitTarget is designed to exit the trade once the given level is hit. That is what this command does.

If, instead, you want to have the model set your stop to break even once a particular dollar level of profit is reached, you use the setBreakEven command. Here's how you use it:

Let's imagine that you're trading stocks and you want to move your stop to break even once your trade has $1,000 of profit in it (this profit is calculated across the entire position) - you would write (most likely at the end of your program):

Code: Select all

setBreakeven(1000);
If you decided that your position size is going to be variable (sometimes you're long 100 shares, sometimes 300, etc.), you can tell MultiCharts to calculate your profit PER SHARE by first using the SetStopShare command. So, for example, if you want your position to be exited when the profit per share is $1 or greater, you would use:

Code: Select all

setStopShare;
setBreakeven(1);
One thing to note (and this may or may not apply to you) is that you want to be especially careful if you're trying to analyze situations where the model gets into and out of a trade on the same bar. It is impossible for MultiCharts to calculate this correctly without looking through to a more granular data series, because it doesn't know, simply looking at the open-high-low-close of a single bar, which price level was traded first. If you have instances where your model is trying to get into and out of a trade in the same bar, either switch to a smaller time duration (i.e., from 1 day -> 1 hour) or use the "Bar Magnifier" function.

tony
Posts: 420
Joined: 14 Jun 2013
Has thanked: 30 times
Been thanked: 81 times
Contact:

Re: Profit Target and Break Even

Postby tony » 26 Sep 2013

Thank you. Just tried in a simulated account with auto-trading and worked perfect. I appreciate the help!


Return to “MultiCharts”