count trade in week

Questions about MultiCharts and user contributed studies.
shivax
Posts: 90
Joined: 02 Sep 2013
Has thanked: 37 times

count trade in week

Postby shivax » 13 Feb 2018

Hi, i want to count trade in week..

Example: i want to trade only 1 once time

User avatar
Anna MultiCharts
Posts: 250
Joined: 14 Jul 2017
Has thanked: 11 times
Been thanked: 62 times

Re: count trade in week

Postby Anna MultiCharts » 15 Feb 2018

Hello, shivax!

In manual trading you can do that by just counting the number of trades yourself or monitoring them in the Order and Position Tracker.
If you need to do that in autotrading, then your strategy should memorize the time of the trades and in case you need more than just one trade a week it should also remember the number of trades that were already done during the specified period. Please refer to the Strategy Position and Strategy Position Trades sections of our Wiki:
https://www.multicharts.com/trading-sof ... y_Position
https://www.multicharts.com/trading-sof ... ion_Trades

shivax
Posts: 90
Joined: 02 Sep 2013
Has thanked: 37 times

Re: count trade in week

Postby shivax » 15 Feb 2018

hi, anna

and how i code the news week?

i must to know when the next week starts

User avatar
fbertram
Posts: 161
Joined: 16 Oct 2014
Location: Seattle, USA
Has thanked: 37 times
Been thanked: 68 times
Contact:

Re: count trade in week

Postby fbertram » 16 Feb 2018

Hi Shivax,

try something along the lines of:

Code: Select all

if DayOfWeeek(DateTime[0]) < DayOfWeek(DateTime[1])) then
begin
   // a new week has started
   // memorize the total number of trades
end else begin
   // we are somewhere in the middle of the week
   // trades this week is total number of trades minus the number at the beginning of the week
end;


This should get you pretty close to what you are looking for. Please excuse any typos or other errors, I no longer have an EasyLanguage license available.

https://www.multicharts.com/trading-sof ... p/DateTime
https://www.multicharts.com/trading-sof ... e_Routines


Cheers, Felix
These users thanked the author fbertram for the post:
shivax


Return to “MultiCharts”