Trading Articles
Article Categories
Article Tools
need help with easy language OR breakout code:)
Updated May 12, 2022
trending_up
131 views
thumb_up
0 thanks given
group
1 followers
forum
0 posts
attach_file
0 attachments
Welcome to futures io: the largest futures trading community on the planet, with well over 150,000 members
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to
register in order to view the content of the threads and start contributing to our community.
It's free and simple.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
need help with easy language OR breakout code:)
(login for full post details)
#1 (permalink )
Amsterdam, Netherlands
Experience: Intermediate
Posts: 2 since May 2022
Thanks: 0 given,
0
received
Hi guys,
I am new to this forum and I would like to get your support on the following strategy that I would like to adjust to trade the OR breakout for futures. I found this code on another post and I would like to make following modifications:
- add opening and closing time (for me 15.30 and 22.00 since I am based in Europe)currently this code takes the first bar of the day on the chart. I could use the index tickers but I usually trade on futures index
- add stop loss @high/low of opening range when going short/long
- take profit end of the day at 22:01 (CET time)
thanks a lot for your help
here is the code:
Inputs: iRangeLengthMin(30),
iBrakePoints(1),
iEntryTimeLimit(-90),
iContracts(1),
iProfitTarget(500),
Price(Close),
Length(12),
ShowText (true);
Var : OpenRangeTime(CalcTime(SessionStartTime(0,1), iRangeLengthMin)),
EntryTimeLimit(CalcTime(SessionEndTime(0,1), iEntryTimeLimit)),
RangeH(0),RangeL(0), // H&L of range
TimeH(0), TimeL(0), // time of H&L
RangeHtime(0), RangeLtime(0),
vDollarStop(500),
FirstTrade(true),
CustomCond(true),
Cond4trade(true),
vVolumeLenght(7),
ExpAvg(0),
firstcheck(true),
MaxP(0),
DateInFromTo(false);
// New day settings
if Date<>Date[1] then begin
//DateInFromTo= (Date>=iFromYYYMMDD and Date<=iToYYYMMDD);
FirstTrade=true;
RangeH=H; RangeL=L; // first bars High Low are Ranges h&l
TimeH=Time; TimeL=Time;
end;
// Range settings
If L<LowD(0)[1] then TimeL=Time; {if new H or L, remember the time of H or L}
If H>HighD(0)[1] then TimeH=Time;
If Time=OpenRangeTime then begin // if openning range is finished
RangeH=HighD(0);
RangeL=LowD(0);
RangeHtime=TimeH;
RangeLtime=TimeL;
end; // remember Range parameters
// ***************** Trade ******************
CustomCond= true;
Cond4trade = CustomCond and time>OpenRangeTime and time<EntryTimeLimit ; //and DateInFromTo
If Cond4Trade then begin
If FirstTrade and Close>=RangeH then
begin
Buy("BrOR_L1") iContracts contracts Next bar at open;
FirstTrade=false;
end;
If FirstTrade and Close<=RangeL then
begin
sellshort("RrOR_Sh1") iContracts contracts next bar at open;
FirstTrade=false;
end;
end;
SetStopContract;
SetStopLoss(100);
SetProfitTarget(100);
// ******************** Plots and Text ********************
Vars: Decimals(Log(PriceScale)/ Log(10)),
PLot_hi(0),Plot_lo(0),
Low_line(-1),OR_Bar(-1),Hi_Line(-1),
Hi_text(-1),Lo_text(-1);
if time = OpenRangeTime then begin
Plot_hi = HighD(0);
Plot_lo = LowD(0);
{Draw Lines}
Hi_line = TL_new(date,time,Plot_hi,date,SessionEndTime(0,1),Plot_hi);
Tl_setstyle(Hi_line,tool_dashed2);
Tl_setcolor(Hi_line, yellow);
Low_line = TL_new(date,time,Plot_lo,Date,SessionEndTime(0,1),Plot_lo);
Tl_setstyle(Low_line,tool_dashed2);
Tl_setcolor(Low_line,yellow );
OR_bar = TL_new(date,time,Plot_hi,date,time,plot_lo);
TL_setcolor(OR_bar,lightgray);
{Text}
if ShowText then begin
Hi_text = Text_new(Date,SessionStartTime(0,1) ,Plot_hi ,numtostr(Plot_hi,decimals));
Lo_text = Text_new(Date,SessionStartTime(0,1),Plot_lo ,numtostr(Plot_lo,decimals));
end;
end;
Last Updated on May 12, 2022
Ongoing