[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Coding Help



PureBytes Links

Trading Reference Links

I need to code a signal this way on daily chart:

If there is a setup today 

I buy next bar on the open and sell short at today's high.I take profit on
the same bar at today midpoint ((h+l)/2) or I exit on xx points stop loss or
on close;

This is how I coded but it doesn't work the way i thought.

if c<h then begin (setup on today's bar)

buy next bar on open;
sell on High limit;
exitshort at (h+l)/2 stop;
exitshort at entryprice-xx points stop;
end;
I then activate the Close at end of day option on Strategy Builder.

It buys and sells correctly but there is not profit taking on midpoint and
no way to have the stop on the same bar.

Any help please?

Max