NexusFi: Find Your Edge


Home Menu

 





Stop limit orders in MC strat


Discussion in EasyLanguage Programming

Updated
    1. trending_up 12,985 views
    2. thumb_up 9 thanks given
    3. group 2 followers
    1. forum 13 posts
    2. attach_file 2 attachments




 
Search this Thread

Stop limit orders in MC strat

(login for full post details)
  #1 (permalink)
 aczk 
London, UK
 
Experience: Intermediate
Platform: MultiCharts
Trading: equities, futures
Posts: 36 since Jan 2012
Thanks Given: 3
Thanks Received: 2

Hi
Trying to get this to work:

After buy signal on bar one, submit a stop limit order at the high price of the signal bar for the next bar, to catch a breakout.

If the stoplimit order is submitted but not filled after lets say 2 bars, then I want to cancel it.

thx appreciate any feedback!

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
SPY ETF Question
Stocks and ETFs
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
IQFeed MBO data experience
The Elite Circle
ISO Equity Curve Indicator
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Supertradersams Thread Journal on NQ/MNQ
27 thanks
GFIs1 1 DAX trade per day journal
22 thanks
Diary of a simple price action trader
17 thanks
Daytrading ES & NQ
14 thanks
Tao te Trade: way of the WLD
13 thanks

(login for full post details)
  #3 (permalink)
 
Nicolas11's Avatar
 Nicolas11 
near Paris, France
 
Experience: Beginner
Platform: -
Trading: -
Posts: 1,071 since Aug 2011
Thanks Given: 2,232
Thanks Received: 1,769


Hi!

What is your current code?

Nicolas

Envoyé depuis mon GT-I9100 avec Tapatalk

Visit my NexusFi Trade Journal Reply With Quote
(login for full post details)
  #4 (permalink)
 aczk 
London, UK
 
Experience: Intermediate
Platform: MultiCharts
Trading: equities, futures
Posts: 36 since Jan 2012
Thanks Given: 3
Thanks Received: 2

inputs: SellBars(3),Threshold (10);

value1=ThreeBarPattern(0);

if value1 < Threshold and marketposition = 0 then buy next bar at high stop high limit ;


if value1 < Threshold and marketposition = 0 then sellshort next bar at low stop low limit;


setexitonclose;
setbreakeven(75);


Basic skeleton code for now, stuck on the stoplimiting!

Signal bar is determined by value1 then I want to buy/short the breakout of the next bar with a limit stop just above/below the signal bar's high/low. On the picture the lines indicate pretty much what the limit order are meant to catch. So should be stop limits right!?!?


Started this thread Reply With Quote
(login for full post details)
  #5 (permalink)
 
Nicolas11's Avatar
 Nicolas11 
near Paris, France
 
Experience: Beginner
Platform: -
Trading: -
Posts: 1,071 since Aug 2011
Thanks Given: 2,232
Thanks Received: 1,769

OK.

Do you really need a stop-limit entry? Isn't a stop entry enough?

Anyway, what exactly does not work? In other words: what is the problem?
The orders are not executed?
You just want to add the feature "after 2 bars, cancel it"?

Nicolas

Visit my NexusFi Trade Journal Reply With Quote
(login for full post details)
  #6 (permalink)
 
Nicolas11's Avatar
 Nicolas11 
near Paris, France
 
Experience: Beginner
Platform: -
Trading: -
Posts: 1,071 since Aug 2011
Thanks Given: 2,232
Thanks Received: 1,769

In order to help you, below please find an example of code.

The signal is: two HH in a row (= 2 bars with a H higher than the bar before)
In case of signal, entry long next bar with a stop order at the H of the current bar (your breakout)
The signal is valid for 3 bars (the entry level remains the H of the signal pattern, not the H of the last bar).

I do not say that this code is perfect. I've prepared it in 10 minutes. But it can give you food for thought.

Nicolas


Quoting 
Inputs:
NumberBarsLimit ( 4 ),
TextBold ( true ),
TextColor ( red ),
TextOffsetInTicks ( 4 );

Variables:
TickSize ( MinMove / PriceScale ),
NumberOfBarsSinceBuySetup ( 0 ),
SetupHigh ( 0 );

// if we already have an open long position, no need to count:
if MarketPosition = 1 then begin
NumberOfBarsSinceBuySetup = 0;
end;

// increase the counter of bars since the setup was identified:
if NumberOfBarsSinceBuySetup > 0 then begin
NumberOfBarsSinceBuySetup = NumberOfBarsSinceBuySetup + 1;
end;

// if the counter reaches its limit, put it back to zero:
if NumberOfBarsSinceBuySetup = NumberBarsLimit then begin
NumberOfBarsSinceBuySetup = 0;
end;

// setup = buy after two HH in a row:
if MarketPosition = 0 AND NumberOfBarsSinceBuySetup = 0 AND H > H[1] AND H[1] > H[2] then begin
NumberOfBarsSinceBuySetup = 1;
SetupHigh = High;
end;

// entry long:
if MarketPosition = 0 AND NumberOfBarsSinceBuySetup > 0 then Buy next bar at SetupHigh stop;

// exit after two bars:
if MarketPosition = 1 AND BarsSinceEntry >= 2 then Sell next bar at market;

// display the value of the counter on the screen:
if NumberOfBarsSinceBuySetup > 0 then begin
Value2 = Text_New_s(Date, Time_s, L - TextOffsetInTicks * TickSize, NumToStr(NumberOfBarsSinceBuySetup, 0));
Text_SetColor(Value2, TextColor);
Text_SetAttribute(Value2, 1, TextBold);
end;


Visit my NexusFi Trade Journal Reply With Quote
The following 4 users say Thank You to Nicolas11 for this post:
(login for full post details)
  #7 (permalink)
 aczk 
London, UK
 
Experience: Intermediate
Platform: MultiCharts
Trading: equities, futures
Posts: 36 since Jan 2012
Thanks Given: 3
Thanks Received: 2

thx for this. but doesn't this strat just place a stop buy order at the high.

I am looking to put a buy limit order at that spot!

Started this thread Reply With Quote
(login for full post details)
  #8 (permalink)
 
Nicolas11's Avatar
 Nicolas11 
near Paris, France
 
Experience: Beginner
Platform: -
Trading: -
Posts: 1,071 since Aug 2011
Thanks Given: 2,232
Thanks Received: 1,769

Hi @aczk,

Could you kindly clarify?

1. Do you want to place
(a) a limit order (as you said in that message)
or
(b) a stop limit order (as you said in the first message of the thread)?

2. If (b), the stop and the limit orders are both are High of the current bar?

Nicolas

Visit my NexusFi Trade Journal Reply With Quote
(login for full post details)
  #9 (permalink)
 aczk 
London, UK
 
Experience: Intermediate
Platform: MultiCharts
Trading: equities, futures
Posts: 36 since Jan 2012
Thanks Given: 3
Thanks Received: 2

1 (a) to buy highs a stop limit order as we are still below that price!
2 at the high of this bar
thx

Started this thread Reply With Quote
(login for full post details)
  #10 (permalink)
 
Nicolas11's Avatar
 Nicolas11 
near Paris, France
 
Experience: Beginner
Platform: -
Trading: -
Posts: 1,071 since Aug 2011
Thanks Given: 2,232
Thanks Received: 1,769


Hi,

I'm lost. You refer to 1.(a) and "stop limit order" whereas "stop limit order" was 1.(b).
Sorry about my questions: I just want to understand what you want, and it is still unclear.

Nicolas

Visit my NexusFi Trade Journal Reply With Quote





Last Updated on June 19, 2012


© 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