EntryDate

Questions about MultiCharts and user contributed studies.
faraz
Posts: 144
Joined: 25 Feb 2011
Has thanked: 26 times
Been thanked: 57 times

EntryDate

Postby faraz » 07 Mar 2012

Hi,

I want only one entry in one day on intraday bars. I used this below code. But this allow one entry and for further entries don't allow. How I can do this?

Code: Select all

if entrydate(1) = date then oOnePosition= False;

if oOnePosition and condition1 then buy at open;

Thanks

sptrader
Posts: 742
Joined: 09 Apr 2010
Location: Texas
Has thanked: 483 times
Been thanked: 274 times
Contact:

Re: EntryDate

Postby sptrader » 07 Mar 2012

I know that Easylanguage has a function called "Tradestoday" which is easy to use for this purpose..
My solution isn't nearly as elegant but I think it will work. (not tested),
It will reset the "Tradeflg to 1 every night, when the date changes, allowing only 1 trade per day..(if it works)

Code: Select all

vars:tradeflg(0);
if date <> date[1] then begin
tradeflg = 1;
end;

if tradeflg = 1 and condition1 then begin
buy next bar at market;
tradeflg = 0;
end;

faraz
Posts: 144
Joined: 25 Feb 2011
Has thanked: 26 times
Been thanked: 57 times

Re: EntryDate

Postby faraz » 08 Mar 2012

SpTrader Thank You.

I used this

Code: Select all

TradesToday(Date[0]) < 1
and it worked like a charm.

Thanks

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1542 times
Been thanked: 1565 times
Contact:

Re: EntryDate

Postby JoshM » 08 Mar 2012

I know that Easylanguage has a function called "Tradestoday" which is easy to use for this purpose..
I don't have that function in my MultiCharts (7.4).

Image

Sptrader, if the function isn't protected, can you post the code of it here? :)
Attachments
scr.08-03-2012 17.02.46.png
(3.37 KiB) Downloaded 530 times

faraz
Posts: 144
Joined: 25 Feb 2011
Has thanked: 26 times
Been thanked: 57 times

Re: EntryDate

Postby faraz » 08 Mar 2012

I know that Easylanguage has a function called "Tradestoday" which is easy to use for this purpose..
I don't have that function in my MultiCharts (7.4).

Image

Sptrader, if the function isn't protected, can you post the code of it here? :)

JoshM,

Yes, its not added in the list. But MC does have it. Any ways here is the function code if u need it.

Code: Select all

[LegacyColorValue = true];

{
User Function: TradesToday

Inputs : Target date.
Returns: Number of entries on specified date.
Properties
[ ] Auto Detest
[*] Simple
[ ] Series

Sample Usage :
if (TradesToday(Date[0]) >= 2)
then EntryOK = FALSE ;
or
if (Condition1 and Condition2 and TradesToday(Date[0]) < 2)
then begin
{ ... do something here ... }
end ;

Provided by Product Support Dept.
of Omega Research, Inc.
}

Inputs: Date0(NumericSimple) ;
Vars : Loop(0), Cnt(0) ;

Cnt = 0 ;
for Loop = 0 to 10 begin
if (EntryDate(Loop) = Date0)
then Cnt = Cnt + 1 ;
end ; { next Loop }

TradesToday = Cnt ;

sptrader
Posts: 742
Joined: 09 Apr 2010
Location: Texas
Has thanked: 483 times
Been thanked: 274 times
Contact:

Re: EntryDate

Postby sptrader » 08 Mar 2012

I wasn't sure if we could post Omega's code , copyright rules etc. So I didn't.


Return to “MultiCharts”