NexusFi: Find Your Edge


Home Menu

 





random strategy - add scaling in feature


Discussion in MultiCharts

Updated
      Top Posters
    1. looks_one ABCTG with 4 posts (4 thanks)
    2. looks_two treydog999 with 4 posts (0 thanks)
    3. looks_3 PTJDAX with 2 posts (0 thanks)
    4. looks_4 sptrader with 2 posts (0 thanks)
    1. trending_up 4,566 views
    2. thumb_up 4 thanks given
    3. group 6 followers
    1. forum 12 posts
    2. attach_file 1 attachments




 
Search this Thread

random strategy - add scaling in feature

  #1 (permalink)
 
treydog999's Avatar
 treydog999 
seoul, Korea
 
Experience: Intermediate
Platform: Multicharts
Broker: CQG, DTN IQfeed
Trading: YM 6E
Posts: 897 since Jul 2012
Thanks Given: 291
Thanks Received: 1,039

Hi I have a random entry generating strategy that can scale out. But I am having trouble implementing a scale in feature. I want to do coin toss experiments comparing scale in scale out and AIAO. but i just cant figure out how to add scaling in. I am looking to enter a random position then add 1 when the Market Position is = 1 or MP = -1.

can anyone help?

 
Code
input:
ProfitTarget( 0 ),
StopLoss (  0  ),
TicksPerPoint(10000),
Scaleout(false);

Variables: {---------------------------------------------------------------------------------}
vRandomNumber(0);

 vRandomNumber = Intportion( Random(100) );
 
   If ( vRandomNumber >= 50 ) and MP = 0 then
   	buy("LE") next bar at market;
   If ( vRandomNumber < 50 ) and MP = 0 then
	sellshort("SE") next bar at market;

If Scaleout = false then begin
If ProfitTarget > 0 then
	setprofittarget ((ProfitTarget*bigpointvalue)/TicksPerPoint);
If Stoploss > 0 then begin
	setstopcontract;
	setstoploss((Stoploss*bigpointvalue)/TicksPerPoint);
	end;

end;
//print(vRandomNumber, "  ", ProfitTarget*bigpointvalue);

if scaleout = true then begin
	if mp = 1 then begin
	sell 1 contract total next bar at (entryprice+(ProfitTarget/TicksPerPoint)) limit;
	sell 1 contract total next bar at (entryprice+2*(profittarget/TicksPerPoint)) limit;
	sell next bar at (entryprice-(StopLoss/TicksPerPoint)) stop;
	end;
	
	if mp = -1 then begin
	buytocover 1 contract total next bar  at (entryprice-(ProfitTarget/TicksPerPoint)) limit;
	buytocover 1 contract total next bar  at (entryprice-(2*ProfitTarget/TicksPerPoint)) limit;
	buytocover next bar at (entryprice+(StopLoss/TicksPerPoint)) stop;
	end;
	
end;

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
REcommedations for programming help
Sierra Chart
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Increase in trading performance by 75%
The Elite Circle
How to apply profiles
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
GFIs1 1 DAX trade per day journal
16 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
13 thanks
My NQ Trading Journal
12 thanks
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

treydog999,
what are the problems you are facing with the scale in part? Do you have it coded and it doesn't do what you have in mind or do you have problems with how to implement it?
If the signal is long and you want to scale in, should add positions on every new bar until the maximum allowed position size is reached?

Regards,
ABCTG

Follow me on Twitter Reply With Quote
  #3 (permalink)
 
treydog999's Avatar
 treydog999 
seoul, Korea
 
Experience: Intermediate
Platform: Multicharts
Broker: CQG, DTN IQfeed
Trading: YM 6E
Posts: 897 since Jul 2012
Thanks Given: 291
Thanks Received: 1,039



ABCTG View Post
treydog999,
what are the problems you are facing with the scale in part? Do you have it coded and it doesn't do what you have in mind or do you have problems with how to implement it?
If the signal is long and you want to scale in, should add positions on every new bar until the maximum allowed position size is reached?

Regards,
ABCTG

I do not have it coded. I tried and failed. I posted the code above which does not scale in but can compile. I want it to scale in at a certain amount of ticks after entry which will be selectable. For example if we go long, i would like to select to scale in after 10 ticks in profit, or 10 ticks at a loss. Reverse for shorts. The above code does random generation already so its just a matter of figuring out how to add the new type of order management.

Started this thread Reply With Quote
  #4 (permalink)
 
sptrader's Avatar
 sptrader 
Colorado
 
Experience: Advanced
Platform: MultiCharts
Broker: IB & Iqfeed
Trading: ES , CL
Posts: 535 since Apr 2010
Thanks Given: 1,097
Thanks Received: 701

I think you could get what you want by using the built-in functions Like- currentcontracts, marketposition and Entryprice;
For the second "scaled in" entry, Something like the code below (untested)..

 
Code
 if mp = 1 and currentcontracts = 1 then buy next bar at entryprice(0) +10 points stop;

Reply With Quote
  #5 (permalink)
 
treydog999's Avatar
 treydog999 
seoul, Korea
 
Experience: Intermediate
Platform: Multicharts
Broker: CQG, DTN IQfeed
Trading: YM 6E
Posts: 897 since Jul 2012
Thanks Given: 291
Thanks Received: 1,039


sptrader View Post
I think you could get what you want by using the built-in functions Like- currentcontracts, marketposition and Entryprice;
For the second "scaled in" entry, Something like the code below (untested)..

 
Code
 if mp = 1 and currentcontracts = 1 then buy next bar at entryprice(0) +10 points stop;

Yeah i been working with that. it just doesn't function right. I am doing this.

 
Code
IF MP = 1 and currentcontracts = 1 then
	buy ("LEscale") 1 contract next bar at entryprice(0) + .0008 stop;
IF MP = -1 and currentcontracts = 1 then
	sellshort("SEscale") 1 contracts next bar at entryprice(0) - .0008 stop;
its 6E so .0001 tick

Started this thread Reply With Quote
  #6 (permalink)
 
treydog999's Avatar
 treydog999 
seoul, Korea
 
Experience: Intermediate
Platform: Multicharts
Broker: CQG, DTN IQfeed
Trading: YM 6E
Posts: 897 since Jul 2012
Thanks Given: 291
Thanks Received: 1,039

Actually it was a stupid mistake, i forgot to turn on scale in ability and recalculate my profit targets .

Started this thread Reply With Quote
  #7 (permalink)
 
sptrader's Avatar
 sptrader 
Colorado
 
Experience: Advanced
Platform: MultiCharts
Broker: IB & Iqfeed
Trading: ES , CL
Posts: 535 since Apr 2010
Thanks Given: 1,097
Thanks Received: 701

Glad you figured it out- GLTY

Reply With Quote
  #8 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

You might also want to take a look at the "Strategy Position Trades" reserved words, as they are build to handle entries and exits with multiple legs and in my opinion give you a lot
more control.




Regards,
ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #9 (permalink)
 
HectorPriamedes's Avatar
 HectorPriamedes 
OMAHA, NEBRASKA
 
Experience: Intermediate
Platform: MULTICHARTS + TOS
Broker: TRADESTATION + TOS
Trading: FUTURES
Posts: 23 since Sep 2011
Thanks Given: 29
Thanks Received: 30

ABCTG (or others),

I was reading your reply post about scaling in/out in BM's advanced EasyLanguage video tutorial thread.



That thread moved onto other topics. Since TreyDog created this thread just for scaling, and what I am doing is so similar, it makes more sense for me to post here and revive this thread.

TreyDog wanted to compare Scaling in and Scaling out to AIAO. I want to use Scaling In and Scaling Out simultaneously and indefinitely. Does regular Multicharts (not .NET) support this?

Must my entry and exit be coded in the same one signal for this to work? If my entry signal and my exit signal are each an independent signal with independent code, and both signals are added to the same chart, does scaling in and scaling out become impossible to achieve?

For scaling in, I was hoping to merely check the signal properties check box to "Allow up to _____ entry orders in the same direction... "

Meanwhile, on the exit side of things, I was building an independent exit signal to exit only 1 contract each time my exit signal is true and my CurrentEntries > 1.

I was hoping the combination of these two things would allow me to scale in and scale out repeatedly and indefinitely, possibly always being in a trade. (I understand I can't be long and short at once) My real question is with the scaling in and scaling out at the same time.

Thanks in advance.

Reply With Quote
  #10 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627


HectorPriamedes,

you can build that and it will work fine in backtesting. If you create issues in realtime will depend on your exact strategy. If you have multiple orders in the market, Multicharts will cancel and resend them in case one order changes.This can become problematic if you handle many open orders at the same time and constantly have to delete/change at least one of them.

Regards,
ABCTG

Follow me on Twitter Reply With Quote
Thanked by:




Last Updated on July 14, 2016


© 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