Entries This Session

Questions about MultiCharts and user contributed studies.
Eduardo
Posts: 21
Joined: 22 May 2020

Entries This Session

Postby Eduardo » 13 Jan 2021

Hello,

I'm trying to code something similar to the Entriestoday function but in relation to the session.

My forex session goes from 1700 to 1659 of the next day, so Entriestoday(date) doesn't work, because there is a change of date during the session.

I guess I'm not the only one with this question but I was not able to find anything.

Can anybody point me in the right direction?

Thank you

User avatar
Svetlana MultiCharts
Posts: 645
Joined: 19 Oct 2017
Has thanked: 3 times
Been thanked: 163 times

Re: Entries This Session

Postby Svetlana MultiCharts » 17 Mar 2021

Hello Eduardo,

You need to create a new Numeric/Simple function named EntriesTodayAndTime.

Code: Select all

inputs: TargetDate( numericsimple ) ; variables: sum1(0) ; for Value1 = 0 to 10 begin if (entrydatetime(Value1) = TargetDate) then begin sum1 = sum1 + 1; print(" DateTime order ------>> ", datetimetostring(datetime) ," ", sum1, " orders " ); end; end ; EntriesTodayAndTime= sum1 ; if sessionlastbar = true then begin print(" Break on Session ------------------- ", datetimetostring(datetime) ," ------------------- ", sum1, " orders in this session " ); sum1 = 0; end;
It is similar to EntriesToday, but the orders are calculated for a session, not for a day. It is just an example that utilizes other conditions and order calculations.

Below is an example of usage.

Code: Select all

once cleardebug; if mod(currentbar, 10) = 0 then begin buy next bar at market; end; if mod(currentbar, 3) = 0 then begin sellshort next bar at market; end; print(datetimetostring(datetime), " ", EntriesTodayAndTime(datetime));


Return to “MultiCharts”