Coding Help: Pyramiding  [SOLVED]

Questions about MultiCharts and user contributed studies.
thespeculator152

Coding Help: Pyramiding  [SOLVED]

Postby thespeculator152 » 08 May 2013

Can someone please help me with the below?

If the below condition occurs I would like to buy one share (buy on close) and hold it for a specific time period, say 10 days (sell on close).

Code: Select all

if low < low[1] and low < low[2] and low < low[3] and low < low[4] then begin
Buy this bar on Close;
This part is easy, however, the same condition might occur multiple days in a row and each day I would like to buy one share and sell each position 10 days after.

I need to track each individual position and sell it after 10 days while adding multiple positions during that period. So, each entry, independent of each other, needs to be held for 10 days only.

How to do that?

Thanks in advance,

TheSpeculator152
Last edited by thespeculator152 on 11 May 2013, edited 1 time in total.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Simple coding help

Postby Henry MultiСharts » 08 May 2013

Hello thespeculator152,

You can use BarsSinceEntry reserved word to achieve your goal.
There was a good tutorial how to use it:
Have a look at following tutorial to help you with your code.
http://markplex.com/free-tutorials/tuto ... id-trades/

thespeculator152

Re: Simple coding help

Postby thespeculator152 » 08 May 2013

Thanks, it worked perfectly.
Screen Shot 2013-05-11 at 4.59.06 PM.png


Return to “MultiCharts”