Immediate stop out of position - TradeStation | futures io social day trading
futures io futures trading


Immediate stop out of position
Updated: Views / Replies:1,848 / 2
Created: by Pritch Attachments:1

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 100,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • 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.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Immediate stop out of position

  #1 (permalink)
Trading Apprentice
Denver Colorado
 
Futures Experience: Intermediate
Platform: TradeStation
Favorite Futures: Futures
 
Pritch's Avatar
 
Posts: 4 since Aug 2013
Thanks: 1 given, 0 received

Immediate stop out of position

Hello everyone,

I have a strategy program that stops out of the position as soon as it is entered (Same bar). I know the answer is probably simple but can't figure it out. Please let me know if you have an idea of the problem. I've attached the code and a picture of what's happening. The strange thing is that sometimes it works... Thank you in advance for any advice!


- Pritch

Attached Thumbnails
Immediate stop out of position-capture.jpg  

Last edited by Pritch; August 9th, 2013 at 03:14 PM. Reason: Took out my Green efforts...
Reply With Quote
 
  #2 (permalink)
 Vendor: www.abctradinggroup.com 
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,808 since Apr 2013
Thanks: 296 given, 1,105 received

I would suggest printing the components that build the stop price to the output bar. That will give you some insights in what is going on.
Another suggestion would be to post the code within code brackets in the forum. The image looks good, but I doubt anyone would type everything into their Tradestation to help you. When you do that, make sure to include the inputs and variables at least for the code snippet you want to reveal (as I can understand in case someone doesn't want to fully reveal a strategy).

Regards,
ABCTG



Pritch View Post
Hello everyone,

I have a strategy program that stops out of the position as soon as it is entered (Same bar). I know the answer is probably simple but can't figure it out. Please let me know if you have an idea of the problem. I've attached the code and a picture of what's happening. The strange thing is that sometimes it works... Thank you in advance for any advice!

Attachment 120680
Attachment 120681
- Pritch


Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #3 (permalink)
Trading Apprentice
Denver Colorado
 
Futures Experience: Intermediate
Platform: TradeStation
Favorite Futures: Futures
 
Pritch's Avatar
 
Posts: 4 since Aug 2013
Thanks: 1 given, 0 received


Thank you ABCTG!

I appreciate your comments. I went ahead and changed the code and in doing so I believe I fixed the problem. I'm posting here for viewing. Thanks Again!

I've never printed components to the output bar so will try to figure that out as well for future reference. Thanks again!



 
Code
Inputs: contractsSet(2), atrPeriods(39), stopAtr(2.6), TradesMax(6), Target1(10), Target2(28), Target3(38);

vars: t1(0), t2(0), t3(0), longlimit1(0), longlimit2(0), longlimit3(0), shortlimit1(0), shortlimit2(0), shortlimit3(0), stopBE(0);
vars: stopPrice(0), trailPrice(0), highMark(0), lowMark(0);
vars: atr(0), minTick(0), tradesToday(0);
vars: EntryLongGood(0), EntryShortGood(0);

If (Date <> Date[1]) then
	Begin	
		tradesToday = 0;
	end; 

minTick = MinMove/PriceScale;

t1 = (target1*minTick);
t2 = (target2*minTick);
t3 = (target3*minTick);

atr = average(avgTrueRange(1), atrPeriods);

If average(Close, 9) > average(Close, 18) then
	begin
		EntryLongGood = 1;
	end
	Else begin
		EntryLongGood = 0;
	end;

If average(Close, 9) < average(Close, 18) then
	begin
		EntryShortGood = 1;
	end
	Else begin
		EntryShortGood = 0;
	end;
	
If (Marketposition <> 1) and
tradesToday < TradesMax and
(EntryLongGood = 1) then
		
	Begin			
		Buy ("LE") (contractsSet * 3) contracts next bar on open;	
		stopPrice = Close - (stopAtr * atr);
		trailPrice = Close - (stopAtr * atr);
		Sell (contractsSet * 3) contracts next bar stopPrice stop;
		highMark = high;
		tradesToday = tradesToday + 1;
	end;


If (Marketposition <> -1) and
tradesToday < TradesMax and
(EntryShortGood = 1) then
	
	Begin
		Sell short ("SE") (contractsSet*3) contracts next bar on open;	
		stopPrice = Close + (stopAtr * atr);
		trailPrice = Close + (stopAtr * atr);
		Buytocover (contractsSet*3) contracts next bar stopPrice stop;
		lowMark = low;
		tradesToday = tradesToday + 1;
	end;

	
// Set Stops & Limits
If (Marketposition = 1) then
	Begin
		longlimit1 = Entryprice(0) + t1;
		longlimit2 = Entryprice(0) + t2;
		longlimit3 = Entryprice(0) + t3;
		stopBE = Entryprice(0) + (minTick * 2);
		If High > highMark then
 			begin
 				trailPrice = Close - stopAtr * atr;
 				highMark = High;
 			end;
		If CurrentContracts = (ContractsSet*3) then
			begin
				Sell ("LX1-CS3Target") contractsSet contracts next bar at longlimit1 limit;
				Sell ("LX2-CS3Target") contractsSet contracts next bar at longlimit2 limit;
				Sell ("LX3-CS3Target") contractsSet contracts next bar at longlimit3 limit;
				Sell ("LX3-CS3Stop") (contractsSet*3) contracts next bar at stopPrice stop;
			end;
		If CurrentContracts = (ContractsSet*2) then
			Begin	
				Sell ("LX2-CS2Target") contractsSet contracts next bar at longlimit2 limit;
				Sell ("LX2-CS2Stop") contractsSet contracts next bar at stopBE stop;
				Sell ("LX3-CS2Target") contractsSet contracts next bar at longlimit3 limit;
				Sell ("LX3-CS2Stop") contractsSet contracts next bar at stopBE stop;
			end;
		If CurrentContracts = (ContractsSet) then
			Begin	
				Sell ("LX1-CS1Stop") contractsSet contracts next bar at trailPrice stop;
			end;
	end;

If (Marketposition = -1) then
	Begin
		shortlimit1 = Entryprice(0) - t1;
		shortlimit2 = Entryprice(0) - t2;
		shortlimit3 = Entryprice(0) - t3;
		stopBE = Entryprice(0) - minTick * 2;
		If Low < lowMark then
 			begin
 				trailPrice = Close + stopAtr * atr;
 				lowMark = Low;
 			end;
		If CurrentContracts = (ContractsSet*3) then
			begin
				buytoCover ("SX1-CS3Target") contractsSet contracts next bar at shortlimit1 limit;
				buytoCover ("SX2-CS3Target") contractsSet contracts next bar at shortlimit2 limit;
				buytoCover ("SX3-CS3Target") contractsSet contracts next bar at shortlimit3 limit;
				buytoCover ("SX3-CS3Stop") (contractsSet*3) contracts next bar at stopPrice stop;
			end;
		If CurrentContracts = (ContractsSet*2) then
			Begin	
				buytoCover ("SX2-CS2Target") contractsSet contracts next bar at shortlimit2 limit;
				buytoCover ("SX2-CS2Stop") contractsSet contracts next bar at stopBE stop;
				buytoCover ("SX3-CS2Target") contractsSet contracts next bar at shortlimit2 limit;
				buytoCover ("SX3-CS2Stop") contractsSet contracts next bar at stopBE stop;
			end;
		If CurrentContracts = (ContractsSet) then
			Begin	
				buytoCover ("SX3-CS1Stop") contractsSet contracts next bar at trailPrice stop;
			end;	
	end;

Setexitonclose;

Reply With Quote

Reply



futures io > > > > Immediate stop out of position

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

September Journal Challenge (sponsored by TopstepTrader)

September

Battlestations! Win $947 in prizes for showing us your trading desk!

October
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting a Stop loss for all Position arjfca Elite EasyLanguage Automated Trading 3 November 28th, 2012 08:16 AM
most used position kbit Jokes 0 June 1st, 2012 08:19 PM
Contract Rollover: Adopt Real World Position and manage per previous position entry RM99 EasyLanguage Programming 3 May 30th, 2012 06:55 AM
Stop strategy disabling when position closed. phantogram NinjaTrader Programming 5 May 19th, 2011 09:29 AM
"Stop If Bid" command for entry's and stop loss arjfca EasyLanguage Programming 4 October 7th, 2010 05:05 PM


All times are GMT -4. The time now is 02:13 PM. (this page content is cached, log in for real-time version)

Copyright © 2018 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, 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
Page generated 2018-10-23 in 0.09 seconds with 15 queries on phoenix