profit target change help  [SOLVED]

Questions about MultiCharts and user contributed studies.
treksis
Posts: 13
Joined: 18 Jul 2014
Has thanked: 4 times

profit target change help  [SOLVED]

Postby treksis » 18 Jul 2014

Hi, I am new to multicharts and I've been trying to make my own profit target signal.
Instead of using $ and % as profit target, how can I make the program to close my short position when slow stochastic reaches less than equal to 50?
the code gets compiled but I don't seem to get any trades done.
Can someone please test this and adjust it to work?

Code: Select all

/// setting up profit close when slow stochastic reaches 50
[IntrabarOrderGeneration = false]
inputs: Amount( 5 ), PositionBasis( false ) ;


Vars: oFastK(0), oFastD(0), oSlowK(0), oSlowD(0);
Value1 = Stochastic(H, L, C, 14, 3, 3, 1, oFastK, oFastD, oSlowK, oSlowD);



if PositionBasis then
SetStopPosition
else
SetStopShare ;

if MarketPosition = 1 and value1 > 50 then
SetProfitTarget( Amount ) ;

Code: Select all

////////// shorting when slow stochastic closes below 80;
inputs: Length( 14 ), OverBought( 80 ) ;
variables: var0( 0 ), var1( 0 ), var2( 0 ), var3( 0 ) ;

Value1 = Stochastic( H, L, C, Length, 3, 3, 1, var0, var1, var2, var3 ) ;

condition1 = CurrentBar > 2 and var2 crosses under var3 and var2 > OverBought ;
if condition1 then
Sell Short ( "StochSE" ) next bar at market ;
Last edited by treksis on 19 Jul 2014, edited 1 time in total.

treksis
Posts: 13
Joined: 18 Jul 2014
Has thanked: 4 times

Re: profit target change help

Postby treksis » 20 Jul 2014

Found out myself. thank you TJ for the links.


Return to “MultiCharts”