Bot Trading - MCL Futures - futures io
futures io



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 SMCJB with 9 posts (13 thanks)
    4. looks_4 Hulk with 9 posts (19 thanks)
      Best Posters
    1. looks_one Hulk with 2.1 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 8,900 views
    2. thumb_up 112 thanks given
    3. group 456 followers
    1. forum 119 posts
    2. attach_file 15 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)

 
Search this Thread
 

Bot Trading - MCL Futures

(login for full post details)
  #1 (permalink)
 gftrader 
Cleveland, Ohio
 
Experience: Advanced
Platform: Tradestation
Trading: Futures
 
Posts: 14 since Aug 2022
Thanks: 6 given, 3 received

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!

Started this thread Reply With Quote
The following 2 users say Thank You to gftrader for this post:

Can you help answer these questions
from other members on futures io?
East West Petroleum Corp - EW (Canada) – EWPMF (USA) …
Stocks and ETFs
SafeDayTradingorg
Trading Reviews and Vendors
Jumpstart Trading
Trading Reviews and Vendors
AddPlotNames2a support thread
NinjaTrader
TradingView like VOLUME indi for Ninja8 ?!?!
NinjaTrader
 
 
(login for full post details)
  #2 (permalink)
 syswizard 
Philadelphia PA
 
Experience: Advanced
Platform: Multicharts
Broker: Ironbeam, Rithmic
Trading: Emini ES / NQ / CL / RTY / YM / BTC
 
syswizard's Avatar
 
Posts: 223 since Jan 2019
Thanks: 12 given, 101 received


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.

Are you willing to share a percent of your profits from this bot ?
What's the number ? 50%, 80%, what ?
Coding and testing these "BOTS" are hugely time-consuming.

Reply With Quote
The following user says Thank You to syswizard for this post:
 
(login for full post details)
  #3 (permalink)
 kevinkdog   is a Vendor
 
 
Posts: 3,399 since Jul 2012
Thanks: 1,798 given, 6,868 received


Free, but many people do not like the only roughly 12 trades per year... Flat periods are just sitting on your hands...






I should mention all performance since Jan 1, 2022 is LIVE real time performance (strategy was developed in 2021).


Crazy simple stupid...

input: daysback(65),stopl(3000),fac(1.5);


if ADX(14)>10 and close-close[daysback] crosses above 0 then buy next bar at market;
if ADX(14)>10 and close-close[daysback] crosses below 0 then sellshort next bar at market;

SetStopPosition;
SetStopLoss(stopl);


SetProfitTarget(stopl*fac);

Follow me on Twitter Reply With Quote
The following 7 users say Thank You to kevinkdog for this post:
 
(login for full post details)
  #4 (permalink)
 trendisyourfriend 
Legendary Market Wizard
Quebec
 
Experience: Intermediate
Platform: NinjaTrader wt Rancho Dinero's profiling tools
Broker: AMP/CQG
Trading: ES, NQ, YM
 
trendisyourfriend's Avatar
 
Posts: 4,245 since Oct 2009
Thanks: 3,903 given, 5,596 received

@kevinkdog

Thanks for sharing the strat.

Could you explain the close-close(65) crosses > or < 0

Does the stopl mean 3000 dollars with a risk:reward of 1.5?

Reply With Quote
The following user says Thank You to trendisyourfriend for this post:
 
(login for full post details)
  #5 (permalink)
 kevinkdog   is a Vendor
 
 
Posts: 3,399 since Jul 2012
Thanks: 1,798 given, 6,868 received


trendisyourfriend View Post
@kevinkdog

Thanks for sharing the strat.

Could you explain the close-close(65) crosses > or < 0

Does the stopl mean 3000 dollars with a risk:reward of 1.5?

If the previous bar close-close[65] was less than 0, and now the current bar close-close[65] is greater than 0, that is a cross above 0.

stopl=3000 and profit target=1.5*3000 = 4500, but these are not the only exits. There could be a reverse trade (long to short).

Follow me on Twitter Reply With Quote
The following 5 users say Thank You to kevinkdog for this post:
 
(login for full post details)
  #6 (permalink)
 syswizard 
Philadelphia PA
 
Experience: Advanced
Platform: Multicharts
Broker: Ironbeam, Rithmic
Trading: Emini ES / NQ / CL / RTY / YM / BTC
 
syswizard's Avatar
 
Posts: 223 since Jan 2019
Thanks: 12 given, 101 received

You need to re-run the backtest with
 
Code
SetProfitTarget(stopl*fac)
removed.
Implement a trailing stop.....much better.

Reply With Quote
The following user says Thank You to syswizard for this post:
 
(login for full post details)
  #7 (permalink)
 kevinkdog   is a Vendor
 
 
Posts: 3,399 since Jul 2012
Thanks: 1,798 given, 6,868 received


syswizard View Post
You need to re-run the backtest with
 
Code
SetProfitTarget(stopl*fac)
removed.
Implement a trailing stop.....much better.



A better backtest is not the end goal here.

But feel free to share your trailing stop code if you want (I hope it is not setdollartrailing or setperecenttrailing).

Follow me on Twitter Reply With Quote
The following user says Thank You to kevinkdog for this post:
 
(login for full post details)
  #8 (permalink)
 syswizard 
Philadelphia PA
 
Experience: Advanced
Platform: Multicharts
Broker: Ironbeam, Rithmic
Trading: Emini ES / NQ / CL / RTY / YM / BTC
 
syswizard's Avatar
 
Posts: 223 since Jan 2019
Thanks: 12 given, 101 received


kevinkdog View Post
But feel free to share your trailing stop code if you want (I hope it is not setdollartrailing or setperecenttrailing).

Ok Kevin, here you go. This signal features a retracement percentage that can be adjusted.
Also features a fixed stop as well as a volatility stop. Note: both can be active at the same time,
but the fixed stop takes precedent.
 
Code

Inputs: 
	iBarsSince (4) // min # of bars in the trade before the stop logic is triggered
,	iProfitTicksMin (10) 
,	iPercentRetrace (25) 
,	iFixedStopTicks (-20) // set to zero to disable
,	iVolaTilLength (10)	// Set to zero to disable
,	iDebug(false)
,	iDebugDate("") // Format=2022/12/01
;	
Variables: 
	vProfitPts(0)
,	vProfitTicks(0)
,	vProfitTicksMax(0)
,	vProfitPctFromMax(0)
,	vMP(0)
,	vEP(0)
,	vBSE(0)
,	vVolaTilTicks (0)
,	vRetVal(-1)
,	vTicksPerPoint (1/TickSize) // ticksize for ES = 0.25
,	vDebugFile("D:\MultichartsData\debug\szylTrailTicksPctSig.txt")
;
vMP = MarketPosition; vEP = EntryPrice; vBSE = BarsSinceEntry;

vProfitPts = sign(vMP)*(Close-vEP);
vProfitTicks = Iff(vProfitPts <> 0 , Round(vTicksPerPoint * vProfitPts,0), 0) ;
vVolaTilTicks = Round(_szHIHILOLO(iVolaTilLength) * vTicksPerPoint,0);

If vMP <> vMP[1] Then // change in position
	vProfitTicksMax = vProfitTicks // initialize the max profit
Else if vMP <> 0 Then // recompute max profit
	vProfitTicksMax = Iff(vProfitTicks > VProfitTicksMax, vProfitTicks, vProfitTicksMax) 
;

if vProfitTicksMax <> 0 Then // Compute the retracement percentage
	vProfitPctFromMax = 100 * ((vProfitTicksMax - vProfitTicks)/vProfitTicksMax)
Else vProfitPctFromMax = 0;

if iDebug and (_szFormatDate()= iDebugDate or iDebugDate = "") then
	 Print(File(vDebugFile),"debug for MP=",vMP:2:0," vProfitTicks=",vProfitTicks,
	 " vProfitTicksMax=",vProfitTicksMax," ","vProfitPctFromMax=",vProfitPctFromMax," ",iDebugDate," ",NumToStr(Time,0));

// Profit retracement exit
If vProfitPctFromMax > iPercentRetrace	and vProfitTicksMax > iProfitTicksMin and vBSE > iBarsSince then
Begin
	if vMP > 0 Then
		Sell ("TrlPctXL") CurrentContracts Contracts This Bar at Close
	Else If vMP < 0 Then
		BuyToCover ("TrlPctXS") CurrentContracts Contracts This Bar at Close;
End;

// Fixed stop loss
if vProfitTicks < iFixedStopTicks and iFixedStopTicks <> 0 Then
Begin
	if vMP > 0 Then
		Sell ("FixedStopXL") CurrentContracts Contracts This Bar at Close
	Else If vMP < 0 Then
		BuyToCover ("FixedStopXS") CurrentContracts Contracts This Bar at Close;
End;

// Volatility stop loss
if vProfitTicks < -vVolaTilTicks and iVolaTilLength <> 0 Then
Begin
	if vMP > 0 Then
		Sell ("VolaTilStopXL") CurrentContracts Contracts This Bar at Close
	Else If vMP < 0 Then
		BuyToCover ("VolaTilStopXS") CurrentContracts Contracts This Bar at Close;
End;


Reply With Quote
 
(login for full post details)
  #9 (permalink)
 kevinkdog   is a Vendor
 
 
Posts: 3,399 since Jul 2012
Thanks: 1,798 given, 6,868 received

Thanks for sharing. How many of those inputs did you optimize to get a better curve?

I'm curious, for the strategy I gave, what did you see that made you want to make it better?

I should also mention your trailing stop code, with "sell/buytocover this bar on close" will NEVER work in real time with daily bars. Backtest is fine, but not live trading. Not sure if you realized this.



Just FYI, I did not do optimization of this, all values were a "best guess." Initial data was 02/2010 to 06/2019.

From June 2019- Jan 2022 (2.5 years was out of sample).

Jan 2022- present is all live, real time performance (as calculated by backtest engine).

Follow me on Twitter Reply With Quote
The following 3 users say Thank You to kevinkdog for this post:
 
(login for full post details)
  #10 (permalink)
 syswizard 
Philadelphia PA
 
Experience: Advanced
Platform: Multicharts
Broker: Ironbeam, Rithmic
Trading: Emini ES / NQ / CL / RTY / YM / BTC
 
syswizard's Avatar
 
Posts: 223 since Jan 2019
Thanks: 12 given, 101 received



kevinkdog View Post
Thanks for sharing. How many of those inputs did you optimize to get a better curve?

No optimization done. Testing done on a 600 tick chart.

kevinkdog View Post
I'm curious, for the strategy I gave, what did you see that made you want to make it better?

Which strategy ?

kevinkdog View Post
I should also mention your trailing stop code, with "sell/buytocover this bar on close" will NEVER work in real time with daily bars. Backtest is fine, but not live trading. Not sure if you realized this.

I am using intraday bars, but I would like to know the reason that it will never work on daily bars. Sheesh, I learn something every day.

Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > Bot Trading - MCL Futures


Last Updated on September 23, 2022


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
     



Copyright © 2022 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
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.
no new posts