Very confused---stop wont move with the candles - MetaTrader | futures trading

Go Back

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > MetaTrader

Very confused---stop wont move with the candles
Started:September 1st, 2015 (12:27 AM) by bondstrader Views / Replies:356 / 0
Last Reply:September 1st, 2015 (12:27 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

Very confused---stop wont move with the candles

Old September 1st, 2015, 12:27 AM   #1 (permalink)
Trading Apprentice
Dubai, UAE
Futures Experience: Advanced
Platform: Multicharts
Favorite Futures: Gold
Posts: 10 since Sep 2014
Thanks: 2 given, 1 received

Very confused---stop wont move with the candles

Hopefully someone can help me out of this.
In the following code opening a long position if the current price is higher than the previous candle's High.
Then I set a profit target, and a stop loss. The profit target is static, so that works fine, but the stop loss is variable. I have set it to look for the lowest price of the last 5 candles, and set that as a stop loss. However, in my code, what it does is that it sets the stop loss based on the lowest price of the 5 candles before the trade candle, and fixes it at that value.
I want the stop to keep on moving with each candle, i-e, after each candle, it evaluates the lowest value of the last 5 candles and sets the stop as that....
Any ideas on what Im missing, or what I need to add to the following code to achieve that?

		if (OrderCloseTime() != 0 || LongTicket == 0)

bool buy_condition_1 = Ask >= High[1]; 

 if( buy_condition_1)
		      LongTicket = OrderSend(Symbol(),OP_BUY,LotSize,Ask,0,0,0,"Buy Order",MagicNumber,0,Green);
		      double OpenPrice = OrderOpenPrice();
                      double LongStopLoss =  Low[iLowest(NULL,0,MODE_LOW,5,1)];
                      double LongTakeProfit = OpenPrice + (TakeProfit * TickPoints);
				if(LongStopLoss > 0 || LongTakeProfit > 0) 
                       bool LongMod = OrderModify(OrderTicket(),OpenPrice,LongStopLoss, LongTakeProfit,0);

Reply With Quote

Reply > Futures Trading, News, Charts and Platforms > Platforms and Indicators > MetaTrader > Very confused---stop wont move with the candles

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
Move stop loss after profit target is reached tbird NinjaTrader 3 August 28th, 2015 03:45 PM
What does it mean to move stop to break even shots fired Index Futures Trading 11 July 3rd, 2013 10:41 PM
Ninjatrader candles wont update ncsutrader NinjaTrader 2 December 20th, 2012 02:19 PM
on NT7 - Anyway to make market replay have orders sit on the dom/ move stop loss? Itchymoku NinjaTrader 4 May 13th, 2012 01:50 AM
MOVE STOP LOSS AFTER STRATEGY firecan NinjaTrader Programming 2 December 13th, 2010 05:54 AM

All times are GMT -4. The time now is 09:43 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.06 seconds with 20 queries on phoenix via your IP