Resetting Variables in MC Signal - MultiCharts | futures io social day trading
futures io futures trading


Resetting Variables in MC Signal
Updated: Views / Replies:1,521 / 11
Created: by reticent67 Attachments:0

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 90,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
 

Resetting Variables in MC Signal

  #1 (permalink)
Elite Member
Los Angeles
 
Futures Experience: Intermediate
Platform: Sierra Chart
Favorite Futures: Stocks
 
Posts: 6 since Jun 2012
Thanks: 1 given, 0 received

Resetting Variables in MC Signal

Hi All,

I've been lurking on this forum for a few months now, but this is my first post so... Hi!


I'm not a programmer and after a few months of getting frustrated with C#, I decided to switch from NinjaTrader to MC (demo only at this point). I've read most of the Wiki (not very helpful) and have searched but haven't been able to find a clear answer.

Anyway, I'm trying to get my NT strategy coded into MC. I have a bool variable that gets set to true when one indicator reaches a value. Then if that bool is true and my second indicator reaches its value, a sell is triggered.

The problem is that in Ninja, I used the OnOrderExecution method to reset my bool variable to false whenever I entered a trade. But now in MC, my variable is not getting reset and giving me the wrong exits.

So, how exactly do I go about resetting my variable once I enter my position in MC?

Thanks in advance.
Rick

Reply With Quote
 
  #2 (permalink)
Trading for Fun
London
 
Futures Experience: None
Platform: mc, TS, ninja
Favorite Futures: es
 
Bimi's Avatar
 
Posts: 118 since Mar 2010
Thanks: 42 given, 58 received


reticent67 View Post
Hi All,

I've been lurking on this forum for a few months now, but this is my first post so... Hi!


I'm not a programmer and after a few months of getting frustrated with C#, I decided to switch from NinjaTrader to MC (demo only at this point). I've read most of the Wiki (not very helpful) and have searched but haven't been able to find a clear answer.

Anyway, I'm trying to get my NT strategy coded into MC. I have a bool variable that gets set to true when one indicator reaches a value. Then if that bool is true and my second indicator reaches its value, a sell is triggered.

The problem is that in Ninja, I used the OnOrderExecution method to reset my bool variable to false whenever I entered a trade. But now in MC, my variable is not getting reset and giving me the wrong exits.

So, how exactly do I go about resetting my variable once I enter my position in MC?

Thanks in advance.
Rick

are you using market orders?
you can simply add a line after your order (within the same conditional block):

 
Code
if bool1 = true and bool2 = true then begin

     sell....

     bool1 = false;
     bool2 = false;

end;

Reply With Quote
 
  #3 (permalink)
Elite Member
Los Angeles
 
Futures Experience: Intermediate
Platform: Sierra Chart
Favorite Futures: Stocks
 
Posts: 6 since Jun 2012
Thanks: 1 given, 0 received


Thank you for the response, Bimi.

Unfortunately that doesn't give the required result. The problem (I think) is that I have multiple entry order conditions and they keep overriding the bool variable during the trade. No matter where I put the "bool = false;" statement, I keep getting the wrong results. I had this same problem with Ninja until I reset the variables in the OnOrderExecution section.

Here is my code, maybe someone can take a look and tell me where I need to put my reset to get the desired result:

By the way, this signal is only for URTY or TNA. It backtested 77% profitable with a .73 Sharpe Ratio (in NinjaTrader) so feel free to try it out.

 
Code
inputs:
	DS_Period(3),
	DS_Smoothing(3),
	MoLength(13),
	Overbought(76),
	Oversold(22);
	
	
vars:
	DSVal(0),
	MoVal(0),
	okSell(false),
	uptrend(false),
	downtrend(false),
	wmaV(0),
	ema1V(0),
	ema2V(0);
	
	
DSVal = DoubleStochastics(DS_Period, DS_Smoothing);
MoVal = Momentum(Close, MoLength);
wmaV  = WAverage(Close, 13);
ema1V = XAverage(Close, 13);
ema2V = XAverage((High + Low) / 2, 13);

{Check For Trend}
//Uptrend//
if Open > wmaV and Close > wmaV  and wmaV > ema1V and ema1V > ema2V then 
	uptrend = True
	else uptrend = false;
	

	

{Entry Order Management}
//Normal Entry
if marketposition = 0 and DSVal[1] < Oversold then begin
	Buy ("Normal Entry") next bar at market;
end;

//Uptrend Entry

if uptrend  then begin
	if marketposition = 0 and barssinceexit(1) >= 1 and DSVAL > DSVal[1] then
		Buy ("Uptrend Entry") next bar at market;
end;



{Set The Sell Trigger Variable}
if marketposition = 1 and DSVal crosses above Overbought then begin
		okSell = true;
end;


{Exit Order Management}

//Normal Exit	
if marketposition = 1 and OkSell and MoVal < MoVal[1] then begin
	Sell ("Normal Exit") from Entry ("Normal Entry") next bar at Market;
	okSell = false;
end;

//Trend Exit
if marketposition = 1 and barssinceentry(0) >= 1 and okSell and MoVal < MoVal[1] then begin
	Sell ("Down Day") from Entry ("Uptrend Entry") next bar at Market;
	okSell = false;
	
end;

//Uptrend Ends Mid-Trade
if marketposition = 1 and Close < wmaV or Open < wmaV or ema1V crosses below ema2V then
	Sell ("Uptrend End") From Entry ("Uptrend Entry") next bar at market;

Reply With Quote
 
  #4 (permalink)
Trading for Fun
London
 
Futures Experience: None
Platform: mc, TS, ninja
Favorite Futures: es
 
Bimi's Avatar
 
Posts: 118 since Mar 2010
Thanks: 42 given, 58 received

do you have the function DoubleStochastics?

Reply With Quote
 
  #5 (permalink)
Elite Member
Los Angeles
 
Futures Experience: Intermediate
Platform: Sierra Chart
Favorite Futures: Stocks
 
Posts: 6 since Jun 2012
Thanks: 1 given, 0 received


Quoting 
do you have the function DoubleStochastics?

Yes, I do. And the entries are working as expected. It's just the exits that are in the wrong place.


Last edited by reticent67; November 2nd, 2012 at 07:11 PM.
Reply With Quote
 
  #6 (permalink)
Trading for Fun
London
 
Futures Experience: None
Platform: mc, TS, ninja
Favorite Futures: es
 
Bimi's Avatar
 
Posts: 118 since Mar 2010
Thanks: 42 given, 58 received

is this the complete strategy?
it does not look complete.
when you reset your logic, you have to follow the flow, and reset at the specific juncture, and the flow seem something is missing.

Reply With Quote
 
  #7 (permalink)
Trading for Fun
London
 
Futures Experience: None
Platform: mc, TS, ninja
Favorite Futures: es
 
Bimi's Avatar
 
Posts: 118 since Mar 2010
Thanks: 42 given, 58 received

What is the chart resolution you are using? Daily? hourly?

Reply With Quote
 
  #8 (permalink)
Elite Member
Los Angeles
 
Futures Experience: Intermediate
Platform: Sierra Chart
Favorite Futures: Stocks
 
Posts: 6 since Jun 2012
Thanks: 1 given, 0 received

For the most part, yes. This the complete strategy. It's meant to be the first half of a pair trade with SRTY (or TZA in the case of TNA). It's a swing trade run on daily bars. Basically, I'm optimizing this half because it is the most profitable. In the end, it will pretty much be "go long SRTY when you're not long URTY."

I have no stop loss or other risk measures because in all tests they have only hurt performance. The only thing left to implement is how to handle the trades during a downtrend as this really the only time I incur my biggest losses.

Reply With Quote
 
  #9 (permalink)
Trading for Fun
London
 
Futures Experience: None
Platform: mc, TS, ninja
Favorite Futures: es
 
Bimi's Avatar
 
Posts: 118 since Mar 2010
Thanks: 42 given, 58 received


reticent67 View Post
For the most part, yes. This the complete strategy. It's meant to be the first half of a pair trade with SRTY (or TZA in the case of TNA). It's a swing trade run on daily bars. Basically, I'm optimizing this half because it is the most profitable. In the end, it will pretty much be "go long SRTY when you're not long URTY."

I have no stop loss or other risk measures because in all tests they have only hurt performance. The only thing left to implement is how to handle the trades during a downtrend as this really the only time I incur my biggest losses.

I would suggest you to double up on the filters , so that you can add a layer of protection on the conditionals.

Good luck.

Reply With Quote
 
  #10 (permalink)
Elite Member
Los Angeles
 
Futures Experience: Intermediate
Platform: Sierra Chart
Favorite Futures: Stocks
 
Posts: 6 since Jun 2012
Thanks: 1 given, 0 received


Forgive my ignorance, I don't quite follow your meaning.

Are saying that I should add more confirmation (i.e. indicators) to my strategy or is there some sort of code that I should be implementing to increase reliability?

Thanks again for all your time and responses.

Reply With Quote

Reply



futures io > > > > Resetting Variables in MC Signal

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
MC Traders dynamic index -> conveting to MC yiman MultiCharts 12 August 2nd, 2016 11:40 AM
MC 7.4 Global Variables kleff EasyLanguage Programming 4 May 12th, 2012 01:08 AM
Q on signal counting in MC aczk EasyLanguage Programming 6 February 14th, 2012 11:35 AM
Why are we Stacking these Variables? DonStar AmiBroker 1 January 25th, 2012 10:18 AM
Exposing variables kaywai NinjaTrader Programming 4 April 14th, 2011 12:58 PM


All times are GMT -4. The time now is 12:56 PM.

Copyright © 2017 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 2017-12-18 in 0.12 seconds with 19 queries on phoenix via your IP 54.196.201.241