NexusFi: Find Your Edge


Home Menu

 





Bot Trading - MCL Futures


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one syswizard with 30 posts (6 thanks)
    2. looks_two kevinkdog with 26 posts (27 thanks)
    3. looks_3 Hulk with 9 posts (20 thanks)
    4. looks_4 SMCJB with 9 posts (13 thanks)
      Best Posters
    1. looks_one Hulk with 2.2 thanks per post
    2. looks_two FastNCurious with 1.8 thanks per post
    3. looks_3 SMCJB with 1.4 thanks per post
    4. looks_4 kevinkdog with 1 thanks per post
    1. trending_up 22,227 views
    2. thumb_up 114 thanks given
    3. group 457 followers
    1. forum 119 posts
    2. attach_file 15 attachments




 
Search this Thread

Bot Trading - MCL Futures

  #111 (permalink)
 
FatTailChaser's Avatar
 FatTailChaser 
Chicago, Illinois
 
Experience: Intermediate
Platform: Sierra Charts
Broker: Dorman
Trading: ZN
Posts: 10 since Apr 2022
Thanks Given: 1
Thanks Received: 14


syswizard View Post
How important did you find volatility to be incorporated into your systems ?

In the past two weeks I just started incorporating it into backtesting in a systematic way so I can only tell you how its changed the results on different systems for me. It has in general reduced the number of trades significantly and also increased my win rate. I started toying with the idea because I was coding a system that looks for volatility expansion. I was using 63.33% of the volume traded since the previous pit session close as my idea of the area of normal random fluctuation, then filtering by mom, rvol, delta of the bar as an entry. I realized that I am obviously looking for periods of volatility so I brushed up on some vol forecasting methods and stated testing that as a filter on different time frames. Filtering on a daily level has great results but less trades than I was looking for that particular system. Do you incorporate a vol filter as an entry condition for your momentum Strats?

Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
PowerLanguage & EasyLanguage. How to get the platfor …
EasyLanguage Programming
Trade idea based off three indicators.
Traders Hideout
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
How to apply profiles
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
21 thanks
GFIs1 1 DAX trade per day journal
16 thanks
  #112 (permalink)
 
syswizard's Avatar
 syswizard 
Philadelphia PA
 
Experience: Advanced
Platform: Multicharts
Broker: Ironbeam, Rithmic
Trading: Emini ES / NQ / CL / RTY / YM / BTC
Posts: 344 since Jan 2019
Thanks Given: 20
Thanks Received: 146


FatTailChaser View Post
Do you incorporate a vol filter as an entry condition for your momentum Strats?

Not yet. I do use it however in setting Stop Losses and Take Profit targets.
See lower indicator in the attachment. I sometimes use the Average line value outright (white line), but sometimes use the ratio of the actual volatility to the average times the average. This ratio can range from 0.5 to 2.0.

Reply With Quote
  #113 (permalink)
kls06541
New York
 
Posts: 14 since Aug 2022
Thanks Given: 7
Thanks Received: 0



FatTailChaser View Post
Sure bud, that test was pretty simple so I don't mind sharing. That system is trading a 30 min range breakout executing off of a 5 min chart with a daily chart 20 period momentum overlaid onto the 5. The inputs in the 5min chart are high/low over time period so that you get your opening range. High/Low over N bars as the exit parameter, that test is using 1 bar so it exits on a break of the low of the previous 5 min. Entry is filtered directionally by the mom of the daily and by an exponential moving average of the atr to filter for expanding volatility. I use the slope of that ma in the test. Im not going to give you parameters to use but that's the framework for that specific backtest.

My point was more so to join the conversation and share some ways of looking at building systems like these that have helped me like starting to filter for volatility when I'm putting together any momentum strategy. If you have any questions or thoughts feel free to share, Ive been writing a lot of different systems lately so I'm definitely interested in what you guys have found useful too.

Thank you for your reply. I am a beginner, so I am still finding this difficult to understand. I hope to read more and more until I understand.

Reply With Quote
  #114 (permalink)
koganam
Garner, NC/USA
 
Posts: 39 since Dec 2009
Thanks Given: 16
Thanks Received: 42


jeronymite View Post
It was in respect of @kevinkdog but applies to @syswizard as well.

Thanks.

 
Code
input: daysback(65),stopl(3000),fac(1.5);
//Use a lookback of 65
//Use a StopLoss of 3000 from the entry price
//Use a TargetToStopLossFactor of 1.5 times

if ADX(14)>10 and close-close[daysback] crosses above 0 then buy next bar at market;
//if ADX(14) is greater than 10, and Close[1] is less than Close[lookback + 1], and Close[0] is greater than Close[lookback], buy at market

if ADX(14)>10 and close-close[daysback] crosses below 0 then sellshort next bar at market;
//if ADX(14) is less than 10, and Close[1] is greater than Close[lookback + 1], and Close[0] is less than Close[lookback], sell at market

//If you prefer, you can use Momentum of the lookback length crossing above or below zero.

SetStopLoss(StopLoss);
//Set Stop loss relative to entry price

SetProfitTarget(StopLoss * TargetToStopLossFactor);
//Set Target exit relative to entry price

Reply With Quote
  #115 (permalink)
 
Fu510n's Avatar
 Fu510n 
Suffield, CT
 
Experience: Advanced
Platform: MC, TS, Python, Rust
Broker: IB, IQFeed, TS, Kraken
Trading: ES, NQ, RTY, YM, CL, RB, 6E
Frequency: Several times daily
Duration: Seconds
Posts: 144 since Oct 2009
Thanks Given: 902
Thanks Received: 143


syswizard View Post
Not yet. I do use it however in setting Stop Losses and Take Profit targets.
See lower indicator in the attachment. I sometimes use the Average line value outright (white line), but sometimes use the ratio of the actual volatility to the average times the average. This ratio can range from 0.5 to 2.0.

Are those custom indicators (e.g. _szylOBVPctSlope) or something that can be downloaded somewhere?

Thanks!

Follow me on Twitter Reply With Quote
  #116 (permalink)
 jeronymite   is a Vendor
 
Posts: 21 since Jul 2013
Thanks Given: 6
Thanks Received: 22


koganam View Post
 
Code
input: daysback(65),stopl(3000),fac(1.5);
//Use a lookback of 65
//Use a StopLoss of 3000 from the entry price
//Use a TargetToStopLossFactor of 1.5 times
...

Many thanks, koganam. Most useful.

Thanks.

Reply With Quote
  #117 (permalink)
 
syswizard's Avatar
 syswizard 
Philadelphia PA
 
Experience: Advanced
Platform: Multicharts
Broker: Ironbeam, Rithmic
Trading: Emini ES / NQ / CL / RTY / YM / BTC
Posts: 344 since Jan 2019
Thanks Given: 20
Thanks Received: 146


Fu510n View Post
Are those custom indicators (e.g. _szylOBVPctSlope) or something that can be downloaded somewhere?
Thanks!

Strictly custom. I rarely use built-in indicators/signals.

Reply With Quote
Thanked by:
  #118 (permalink)
soacm
Bucharest, Romania
 
Posts: 71 since Mar 2022
Thanks Given: 38
Thanks Received: 22


gftrader View Post
Curious as to whether anyone has been able to code a profitable trading bot specifically for CL or MCL futures? I have been working to accomplish this, and wanted to see if anyone else had a successful bot they were willing to share. Appreciate it!

1 trade x week, Wednesday only, 15min Data1, Daily Data2, $20 of total commissions already included.
 
Code
// CRUDE inventories news, 15min Data1, Daily Data2

input: MyPerc(0.5), StartTime(300), EndTime(1000);

input: MyStopLoss(1500);

input: News(3);

vars: MaxSetup(0), 
      MinSetup(0),
      MP(0), 
      MyRange(0,Data2),
      MyTime(false),
      CanTrade(True);
          
          MP = Marketposition;
          MyTime = False;
          if Time >= StartTime and Time <= EndTime and EntriesToday(date[0]) < 1 then MyTime = True;
          
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////          
           
// Levels

var: CurSess(0);
     CurSess = CurrentSession(0);

if CurSess[1] <> CurSess then begin 
   
   CanTrade = True;
   MyRange =  HighSession(1,1) - LowSession(1,1); 
   MaxSetup = OpenSession(0,0) + MyRange*MyPerc; 
   MinSetup = OpenSession(0,0) - MyRange*MyPerc;
    
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Entries

if 
MP = 0                                                      and 
MyTime = True                                               and 
Close < MaxSetup                                            and 
dayofweek(date) = News                                      then 

   begin 
      Buy next Bar at MaxSetup on Stop;
   end;
      if Time >= 1515 then Sell next bar at open;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

if
MP = 0                                                      and 
MyTime = True                                               and
Close > MinSetup                                            and 
dayofweek(date) = News                                      then                                              

   begin 
      Sellshort next bar at MinSetup on Stop;
   end;
      if Time >= 1515 then Buytocover next bar at open;

// Exits

if MyStopLoss > 0 then Setstoploss(MyStopLoss);

Attached Thumbnails
Click image for larger version

Name:	Returns.png
Views:	83
Size:	32.6 KB
ID:	327157   Click image for larger version

Name:	Crudecurve.png
Views:	77
Size:	23.9 KB
ID:	327158  
Reply With Quote
Thanked by:
  #119 (permalink)
kls06541
New York
 
Posts: 14 since Aug 2022
Thanks Given: 7
Thanks Received: 0


soacm View Post
1 trade x week, Wednesday only, 15min Data1, Daily Data2, $20 of total commissions already included.

 
Code
// CRUDE inventories news, 15min Data1, Daily Data2



input: MyPerc(0.5), StartTime(300), EndTime(1000);



input: MyStopLoss(1500);



input: News(3);



vars: MaxSetup(0), 

      MinSetup(0),

      MP(0), 

      MyRange(0,Data2),

      MyTime(false),

      CanTrade(True);

          

          MP = Marketposition;

          MyTime = False;

          if Time >= StartTime and Time <= EndTime and EntriesToday(date[0]) < 1 then MyTime = True;

          

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////          

           

// Levels



var: CurSess(0);

     CurSess = CurrentSession(0);



if CurSess[1] <> CurSess then begin 

   

   CanTrade = True;

   MyRange =  HighSession(1,1) - LowSession(1,1); 

   MaxSetup = OpenSession(0,0) + MyRange*MyPerc; 

   MinSetup = OpenSession(0,0) - MyRange*MyPerc;

    

end;



////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



// Entries



if 

MP = 0                                                      and 

MyTime = True                                               and 

Close < MaxSetup                                            and 

dayofweek(date) = News                                      then 



   begin 

      Buy next Bar at MaxSetup on Stop;

   end;

      if Time >= 1515 then Sell next bar at open;



////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



if

MP = 0                                                      and 

MyTime = True                                               and

Close > MinSetup                                            and 

dayofweek(date) = News                                      then                                              



   begin 

      Sellshort next bar at MinSetup on Stop;

   end;

      if Time >= 1515 then Buytocover next bar at open;



// Exits



if MyStopLoss > 0 then Setstoploss(MyStopLoss);

Can you please explain in plain English how this strategy works?

Sent using the NexusFi mobile app

Reply With Quote
  #120 (permalink)
soacm
Bucharest, Romania
 
Posts: 71 since Mar 2022
Thanks Given: 38
Thanks Received: 22



kls06541 View Post
Can you please explain in plain English how this strategy works?

Sent using the NexusFi mobile app

The strategy buys or sells if the range is broken during the time window (3am to 10pm exchange time). The trade is closed at the end of the session.
The range is calculated based on the previous daily range and half of it is taken (MyPerc 0.5) and added above and below today's open --> MaxSetup = OpenSession(0,0) + MyRange*MyPerc; MinSetup = OpenSession(0,0) - MyRange*MyPerc;

It trades on Wednesday only because it tries to take advantage of the increased volatility caused by the Crude Oil Inventories.

Reply With Quote
Thanked by:




Last Updated on September 23, 2022


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts