So close! Can anyone help

gfabidder

Newbie
Messages
2
Likes
0
Hey people,

I'm trying to test a simple strategy, but not getting the output I want.

I was able to get my "show me" to kind of work (Plotting lastdayofmonth is correctly, but not plotting 10th day is not working if 10th day is on weekend),

Here is what I have for the Show me:

inputs:
TradeDay ( 10) ; //If 10th day is on weekend it will not Plot? How can I make it plot next trading day then?

If DayOfMonth(date) = LastDayOfMonth(month(date)) then Plot1(Value1) ;

If DayOfMonth(date) = TradeDay then then Plot2(Value2) ;

Value1 = Close ;
Value2 = Close;

I'm testing selling on the "LastDayOfMonth" and Closing the Order on 10th Trading day of next month.

What I did to add this was just change "Plot1..." to "Sell this bar;"

I didn't get an errors when I verified it, but when i put it on the chart, nothing is displaying.

Any help would be really appreciated!

Thanks.
 
Code:
var:
tradeday.count(0);

if m > m[1] then
tradeday.count = 0;

if d > d[1] then
tradeday.count = tradeday.count + 1;
 
Code:
var:
tradeday.count(0);

if m > m[1] then
tradeday.count = 0;

if d > d[1] then
tradeday.count = tradeday.count + 1;

Thanks, I had to update the code like so because it didn't recognize the "m" or "D"

I assumed those represented Day and month

Show me code below:
Code:
inputs:
TradeDay ( 7) ,
TradeDir ( 1 ) ;

If DayOfMonth(date) = LastDayOfMonth(month(date)) then Plot1(Value1) ;

If DayOfMonth(date) = TradeDay then Plot2(Value2) ;

var:
tradeday.count(0);

if LastDayOfMonth(Month(date)) > Lastdayofmonth(Month(date[1])) then
tradeday.count = 0;

if DayofMonth(date) > DayofMonth(date[1]) then
tradeday.count = tradeday.count + 1;

It is not still not plotting all the points? On the last trading day or the 7th trading day?

When I look back it is because the day happens to land on a weekend or holiday...any way around this?

Thanks.
 
the idea is this...

if a new month starts,
reset the counter to zero.

if a new day begins,
add one to the counter.


therefore:
on the first day of the new month,
the counter = zero.

it is a new day, so you add one to the counter,
the counter now becomes ONE.

if you keep on doing this,
sooner then later, the counter will become 10.

you have arrived at the 10th trading day of the month !
 
HI Friend,

here is the code for you..
Code:
inputs:
TradeDay ( 7 );
var:
	tradeday.count(0);

Value1 = Close;

If Month(Date) <> Month(Date[1]) then 
	tradeday.count = 0;
	
if d > d[1] then
	tradeday.count = tradeday.count + 1;
	
If DayOfMonth(date) = LastDayOfMonth(month(date)) then Plot1(Value1) ;
If tradeday.count = TradeDay then Plot2(Value1);

Good Luck.
 
Will this work stuck into a strategy as is or do you need to change the "Plot" words? I thought they wanted to use it in a strategy, and I thought that Plot was unacceptable in a strategy?? I'm just learning EL too and appreciate the posts here. Thanks.
 
Hi ,

Yeah, you need the Plots to be replaced by Buy and Sell .

Plot1 = Buy this bar at Close;(Buy Next bar at Open)
Plot2 = Sell this bar at Close;(Sell Next bar at Open);

Good Luck.
 
Top