same buy/sell signal not allowed

Questions about MultiCharts and user contributed studies.
User avatar
MarketMicro
Posts: 24
Joined: 04 May 2014
Been thanked: 1 time

same buy/sell signal not allowed

Postby MarketMicro » 04 Apr 2017

Hi,

In my signal, I might have the following entry and exit with their identifiable names.

//buy signal
if marketposition=0 and CurrentContracts<TotalAllowedSize and RSI>20 and RSI<40 then
buy ("buyname") 1 contract next bar at Close limit;

//sell signal
if marketposition>=1 and CurrentContracts>0 and RSI>80 then
sell ("sellname") 1 contrtact next bar at Close limit;

Multichart doesn't seem to allow multiple entry or exits even if the entry/exit conditions are met.

Is there a properties setting that needs to be changed in order to allow for more than 1 entry or exit with the same name?

Thank you in advance.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: same buy/sell signal not allowed

Postby TJ » 04 Apr 2017

See posts #1 & #2
viewtopic.php?t=11713

User avatar
MarketMicro
Posts: 24
Joined: 04 May 2014
Been thanked: 1 time

Re: same buy/sell signal not allowed

Postby MarketMicro » 04 Apr 2017

In my signal, I might have the following entry and exit with their identifiable names.
//buy signal
if marketposition=0 and CurrentContracts<TotalAllowedSize and RSI>20 and RSI<40 then
buy ("buyname") 1 contract next bar at Close limit;

//sell signal
if marketposition>=1 and CurrentContracts>0 and RSI>80 then
sell ("sellname") 1 contrtact next bar at Close limit;
Multichart doesn't seem to allow multiple entry or exits even if the entry/exit conditions are met.

Is there a properties setting that needs to be changed in order to allow for more than 1 entry or exit with the same name?

Thank you in advance.

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

Re: same buy/sell signal not allowed

Postby tony » 04 Apr 2017

If you do buy, then your MP is no longer = 0 and therefore that first conditional statement is not true. If you want to continually buy, then you should say if MP <> 0 (doesn't equal 0).

User avatar
MarketMicro
Posts: 24
Joined: 04 May 2014
Been thanked: 1 time

Re: same buy/sell signal not allowed

Postby MarketMicro » 04 Apr 2017

Fair point, Tony. I've made the changes below to illustrate the issue.

I buy 10 contracts once, and want to sell 1 contract at a time. However, MC would only allow sell once, in other words, "sellname" should be executed many times but seems only one time is allowed.

Code: Select all

//buy signal
if marketposition=0 and CurrentContracts<TotalAllowedSize and RSI>20 and RSI<40 then
buy ("buyname") 10 contract next bar at Close limit;

//sell signal
if marketposition>=1 and CurrentContracts>0 and RSI>80 then
sell ("sellname") 1 contract next bar at Close limit;


Return to “MultiCharts”