Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

Radek

Easy Language - Order Last for 24 Hours on 1-min Timeframe

Recommended Posts

Hi,

I would like to place order on 1-min timeframe, but I need it to last for 24 hours or less if it gets executed.

 

Entry will be at 10:00AM with stop loss 100 pips.

If order don't get executed, I will cancel old one and place new one next day.

If stop loss gets hit, I don't want to place it again and I will wait for next 10:00AM to place new order.

If order get executed, I will just move Stop loss at next 10:00AM and place new order.

 

I started to program this strategy, but then I hit problem that easy language does not work as I would when placing order manually (place one order and then wait what happen). In my case easy language place and cancel orders every minute and I can't figure it out how to code this strategy.

Can somebody help me?

 

Radek

Share this post


Link to post
Share on other sites

Problem with this is that orders stay open only one bar, in my case 1min. There is also commented part which I wanted to use to move stop loss, but I didn't get there yet.

 

Radek

 

 

Variable:

OpenTime(1000), //Time when Orders are made

DayATR (0),

MP( 0 ), TT( 0 ),

TodayOpen(0),PreviousDayOpen(0),//Opens at OpenTime

OrderRange(0), SLRange(0), DayRange(0)

 

;

 

 

//data1 = 1 minute

//data2 = 1 hour

//data3 = 1 day

 

 

 

if (Time = OpenTime) then

begin

//calculate data

DayATR = AvgTrueRange(10) of data3;

MP = MarketPosition ;

TT = TotalTrades ;

TodayOpen = Open of data2;

PreviousDayOpen = Open[23] of data2;

DayRange = DayATR * PriceScale;

OrderRange = DayRange * .8;

SLRange = DayRange * .3;

 

{ //if I have long position - move SL

if MP = 1 then

sell on next bar at TodayOpen + (SLRange * 1/PriceScale) stop ;

 

 

//if I have short position - move SL

if MP = -1 then

buytocover on next bar at TodayOpen - (SLRange * 1/PriceScale) stop ;

}

 

//open new order

if TodayOpen < PreviousDayOpen then

begin //long order + SL

buy on next bar at TodayOpen + (OrderRange * 1/PriceScale) stop;

sell on next bar at TodayOpen + (SLRange * 1/PriceScale) stop ;

end

else

begin //short order + SL

sellshort on next bar at TodayOpen - (OrderRange * 1/PriceScale) stop;

buytocover on next bar at TodayOpen - (SLRange * 1/PriceScale) stop ;

 

end;

 

 

end;

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.