+1 888 340 6572 



Post new topic Reply to topic 
EntryDate   [ ]
Author Message
#1 posted 07 Mar 2012 

Status: Offline
Posts: 110
Thanks Received: 16 times
Thanks Given: 23 times
Joined: 25 Feb 2011
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:
if entrydate(1) = date then oOnePosition= False;

if oOnePosition and condition1 then buy at open;



Thanks


#2 posted 07 Mar 2012 

Status: Offline
Posts: 510
Thanks Received: 187 times
Thanks Given: 259 times
Joined: 09 Apr 2010
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:
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;     



For this message the author sptrader has received thanks: 2
faraz, JoshM


#3 posted 08 Mar 2012 

Status: Offline
Posts: 110
Thanks Received: 16 times
Thanks Given: 23 times
Joined: 25 Feb 2011
SpTrader Thank You.

I used this
Code:
TradesToday(Date[0]) < 1
and it worked like a charm.

Thanks


#4 posted 08 Mar 2012 

Status: Offline
Posts: 1163
Thanks Received: 800 times
Thanks Given: 1446 times
Joined: 20 May 2011
sptrader wrote:
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 66 times
#5 posted 08 Mar 2012 

Status: Offline
Posts: 110
Thanks Received: 16 times
Thanks Given: 23 times
Joined: 25 Feb 2011
JoshM wrote:
sptrader wrote:
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:
[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 ;




For this message the author faraz has received thanks:
JoshM


#6 posted 08 Mar 2012 

Status: Offline
Posts: 510
Thanks Received: 187 times
Thanks Given: 259 times
Joined: 09 Apr 2010
I wasn't sure if we could post Omega's code , copyright rules etc. So I didn't.



For this message the author sptrader has received thanks:
JoshM



Post new topic Reply to topic