stoploss and swinghigh/low indicator - NinjaTrader Programming | futures trading

Go Back

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming

stoploss and swinghigh/low indicator
Started:September 16th, 2011 (02:08 PM) by Blackburn Views / Replies:949 / 2
Last Reply:September 21st, 2011 (03:08 AM) Attachments:0

Welcome to

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

stoploss and swinghigh/low indicator

Old September 16th, 2011, 02:08 PM   #1 (permalink)
Elite Member
Malchow (Meckl.)
Futures Experience: Intermediate
Platform: NinjaTrader, TWS
Favorite Futures: Stocks
Posts: 17 since Mar 2011
Thanks: 15 given, 0 received

stoploss and swinghigh/low indicator


in my strategy I am looking for a possibility to automatic change the stoploss on the last swinghigh or low. Do you have a code snippet für me?

My trail:

#region Variables

private IOrder _long_order = null;
private bool _long_sent = false;

private IOrder _short_order = null;
private bool _short_sent = false;

double swinghigh_value = 0;
double swinglow_value = 0;

protected override void OnBarUpdate()
// Condition set 1 (LONG)
if (ToTime(Time[0]) >= 80000 && ToTime(Time[0]) <= 220000
&& WMA(Weighted, 20)[0] > WMA(Weighted, 50)[0]
&& Low[0] > WMA(Weighted, 20)[0]
&& WMA(Weighted, 20)[0] > WMA(Weighted, 20)[4]
&& Close[0] > Swing(5).SwingHigh[0])
_long_order=EnterLong(DefaultQuantity, "Long");

// set swinglow_value:
swinglow_value = Swing(5).SwingLow[0];

// set the stop loss to swinglow_value:
SetStopLoss("Long", CalculationMode.Ticks, swinglow_value, false);

But nothing change ... Where is the error?

Thanks Blackburn

Reply With Quote

Old September 16th, 2011, 02:08 PM   #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.


Old September 21st, 2011, 03:08 AM   #3 (permalink)
Site Administrator
Manta, Ecuador
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
Big Mike's Avatar
Posts: 45,432 since Jun 2009
Thanks: 28,836 given, 79,560 received

First glance your variable "swinglow_value" is a price, but you are using CalculationMode.Ticks instead of Price.


Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote

Reply > Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming > stoploss and swinghigh/low indicator

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

An Afternoon with FIO trader bobwest

Elite only

NinjaTrader 8: Programming Profitable Trading Edges w/Scott Hodson

Elite only

Anthony Drager: Executing on Intermarket Correlations & Order Flow, Part 2

Elite only

Adam Grimes: Five critically important keys to professional trading

Elite only

Machine Learning Concepts w/FIO member NJAMC

Elite only

MarketDelta Cloud Platform: Announcing new mobile features

Dec 1

NinjaTrader 8: Features and Enhancements

Dec 6

Similar Threads
Thread Thread Starter Forum Replies Last Post
stoploss to breakeven to trailing stephenszpak NinjaTrader Programming 13 October 13th, 2014 03:30 PM
How to get the High/Low from the ZigZag indicator in my strategy? NinjaStrategies NinjaTrader Programming 12 July 30th, 2011 11:45 AM
Daily Hi low indicator (testing) marioc NinjaTrader Programming 6 May 6th, 2011 09:18 AM
StopLoss as fraction of ATR FArias NinjaTrader Programming 5 February 23rd, 2011 02:45 PM
N7 SwingHigh/Low DrawText ceramictilepro NinjaTrader Programming 7 February 7th, 2011 07:57 PM

All times are GMT -4. The time now is 11:41 PM.

Copyright © 2016 by 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 2016-10-23 in 0.08 seconds with 20 queries on phoenix via your IP