random strategy - add scaling in feature - MultiCharts | futures.io
futures io futures trading

random strategy - add scaling in feature
Started: by treydog999 Views / Replies:1,382 / 12
Last Reply: Attachments:1

Welcome to futures io.

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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, and we will never resell your private information.

-- Big Mike

Thread Tools Search this Thread

random strategy - add scaling in feature

  #11 (permalink)
Trading Apprentice
Stockholm, Sweden
Futures Experience: Intermediate
Platform: MultiCharts
Favorite Futures: FDAX
Posts: 3 since Jul 2016
Thanks: 4 given, 0 received

Hi guys,

I just joined the forum and was looking for a solution to a scale-in/scale-out problem similar as described in this thread. Like this:

(Platform: Multicharts)
1) I have a strategy that enters with 10 contracts All-in, sets 3 targets with different size. And this works fine.
2) I want to instead investigate how I can enter at multiple bars, 1 contract at a time. I thought this would be easy, but even though the contract accumulation is working correctly, all contracts are dumped on the first target even though I have monitored the size variable and it is set correctly.

Posting the code below. I am sure that this is a piece of cake many of you more experienced guys. Any help is really appreciated. Hope that I can help you guys with other things down the road.

Code for accumulating contracts. This works as expected.

If currentcontracts=ContractMax then begin
ContractC=True; // ensures that once Contract Max is reached there will be no more orders that day to fill up


IF InitialC AND DistanceC AND NOT ContractC THEN begin
Buy ("LONG Scale in trial") positionsize CONTRACTS next bar at Market;
Code for calculating size and targets. I have monitored the 3 different sizes, and the calculations are correct.
However all 10 contracts are sold on "EXIT Long Target1".
if currentcontracts <> 0 then begin 

	Targetsize= TargetScale*entryprice;
	SL1 = entryprice-Stopsize;

	Target1 = Targetsize; 

	Targ= entryprice+Target1*0.75; 
	Targ2= entryprice+Target1*1.4; 
	Targ3= entryprice+Target1*1.6;

	IF (NOT Target1C) then begin // If Targ has not been hit

	sell ("Exit LONG Target1") size1 contracts Next Bar at (Targ) Limit;
	sell ("Exit LONG Target1.2") size2 contracts Next Bar at (Targ2) Limit;
	sell ("Exit LONG Target1.3") size3 contracts Next Bar at (Targ3) Limit;
	IF currentcontracts=size2+size3 then begin
	sell ("Exit LONG Target2") size2 contracts Next Bar at (Targ2) Limit;
	sell ("Exit LONG Target3") size3 contracts Next Bar at (Targ3) Limit;

	IF currentcontracts=size3 then begin
	sell ("Exit LONG Target2.3") size3 contracts Next Bar at (Targ3) Limit;

sell ("Exit Long SL1") currentcontracts contracts Next Bar at SL1 stop;


Reply With Quote
  #12 (permalink)
Elite Member
Hamburg Germany
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
Posts: 1,257 since Apr 2013
Thanks: 201 given, 707 received


you can look into the reserved word "total". This is the explanation from the manual:

Used in strategy exit statements, following a numerical expression and the words Shares or Contracts, to indicate that only the number of contracts or shares specified by the numerical expression is to be sold or covered in total, regardless of the number of open entries. The contracts or shares will be sold or covered in the same order they were bought or shorted: First In, First Out.
If the word Total is not used, the number of contracts or shares specified by the numerical expression will be sold or covered for each one of the open entries.

If this doesn't give you the desired result you will have to tie the exit orders to specific entry orders. For example you can dynamically change the entry name for each order, so each entry is unique. You can for example add the number of contracts at the time of the entry (converted to a string).
This will also ensure that an exit is not re-used.



Reply With Quote
The following user says Thank You to ABCTG for this post:
  #13 (permalink)
Trading Apprentice
Stockholm, Sweden
Futures Experience: Intermediate
Platform: MultiCharts
Favorite Futures: FDAX
Posts: 3 since Jul 2016
Thanks: 4 given, 0 received


That is really excellent advice. I just added "total" and it works as expected now.
Your second suggestion is also a good one and I'll keep that in mind for future work.
Many thanks once again, Vielen Dank nochmal, I really appreciate it.

Best Regards,

Reply With Quote


futures io > > > > random strategy - add scaling in feature

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Upcoming Webinars and Events (4:30PM ET unless noted)

Mastering Trading Pysychology w/Brett Steenbarger & Trading Technologies

Elite only

PTMC Protrader Platform First Look w/Sergey Sokolov

Elite only

Spring Grains Outlook w/Sean Lusk @ Walsh Trading

Elite only

FIO Video Journal Challenge featuring NinjaTrader ($2,000+ of prizes)


Process above all else w/Anthony Crudele @ Futures Radio Show

Elite only

Machine Learning - Quantitative Trading w/Martin Froehler @ Quantiacs

Elite only

Market Dynamics w/Peter Davies @ Jigsaw Trading

Elite only

Ask Me Anything w/Patrick Rooney @ Trading Technologies

Apr 18

Ask Me Anything w/FuturesTrader71

Apr 19

Machine Learning w/Kris Longmore

Elite only

Market Analysis w/Dave Forss

Apr 25

Introducing iSystems with Stage 5 Trading

Apr 27

Similar Threads
Thread Thread Starter Forum Replies Last Post
All in all out vs. scaling in and out caprica Psychology and Money Management 130 December 27th, 2015 01:10 AM
How to add Strategy in a chart? dream3r NinjaTrader 7 October 2nd, 2014 02:32 AM
Techniques for scaling in DarkPoolTrading Psychology and Money Management 4 August 9th, 2012 02:27 PM
Scaling in and scaling out...when the total is NOT the sum of its parts RM99 Psychology and Money Management 8 April 11th, 2012 09:21 AM
Add to original position in NinjaTrader Strategy ryohkyo NinjaTrader Programming 5 March 14th, 2010 10:48 PM

All times are GMT -4. The time now is 04:31 AM.

no new posts
Page generated 2017-03-24 in 0.10 seconds with 20 queries on phoenix via your IP