Allow only one trade per day / limit daily number of trades  [SOLVED]

Questions about MultiCharts and user contributed studies.
jese514
Posts: 16
Joined: 11 Apr 2014
Has thanked: 2 times
Been thanked: 3 times

Allow only one trade per day / limit daily number of trades

Postby jese514 » 11 Jun 2014

Currently, I am doing this:

Code: Select all

if MarketPosition <> 0 then vDailyTrades = 1;
if vDailyTrades >= 1 then #return ;
It works except in the case where one bar enters a trade and then hits the stop in that same bar, thus exiting on the same bar. When this occurs, the program never sees that MarketPosition <> 0 and therefore never sets vDailyTrades = 1.

So then a 2nd trade is allowed to occur on such a day. How can I fix this? Thanks!
Last edited by jese514 on 11 Jun 2014, edited 1 time in total.

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: Allow only one trade per day / limit daily number of tra

Postby Andrew MultiCharts » 11 Jun 2014

Hello jese514,

There are 2 possible workarounds:

jese514
Posts: 16
Joined: 11 Apr 2014
Has thanked: 2 times
Been thanked: 3 times

Re: Allow only one trade per day / limit daily number of tra

Postby jese514 » 11 Jun 2014

Thanks. I will have to figure out how to properly use intrabarordergeneration then.

So, I turn it on. (In the Signal's 'Format' settings, "Enable Intra-Bar Order Generation" with "limit this signal to one entry and one exit per bar" checked).

On this break-out strategy I'm building, the entry price is based on the CLOSE of a certain TIME. I calculate this like this:

Code: Select all

if time = BreakoutTime then vEntryPrice = Close;
But with IOG, now it seems that "close" means the value of every tick, instead of the close of a bar. So, using IOG, how can I make the program select the close of an actual bar?

escamillo
Posts: 203
Joined: 25 Mar 2011
Has thanked: 23 times
Been thanked: 56 times

Re: Allow only one trade per day / limit daily number of tra  [SOLVED]

Postby escamillo » 11 Jun 2014

Code: Select all

Last edited by escamillo on 17 Nov 2014, edited 1 time in total.

jese514
Posts: 16
Joined: 11 Apr 2014
Has thanked: 2 times
Been thanked: 3 times

Re: Allow only one trade per day / limit daily number of tra

Postby jese514 » 11 Jun 2014

Wow, I've read many posts about limiting number of trades per day but had not come across the EntriesToday function. This is perfect. Thanks escamillo!


Return to “MultiCharts”