NexusFi: Find Your Edge


Home Menu

 





Entry stop order stays active? EasyLanguage


Discussion in Platforms and Indicators

Updated
    1. trending_up 4,275 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 6 posts
    2. attach_file 0 attachments




 
Search this Thread

Entry stop order stays active? EasyLanguage

  #1 (permalink)
alexfdv
Ocean City MD/USA
 
Posts: 5 since Jan 2013
Thanks Given: 0
Thanks Received: 0

Hi everybody,

Could you please help me with the next question? I am really stuck with it.

I have created an strategy in EasyLanguage and run it on my OEC Trading Platform. But the problem that my entry stop order stays active much longer then 1 bar. I do the next (cutted version):

 
Code
if (MarketPosition = 0 and TimeCondition = 1) then
begin

    if ( CanGoLong ) then
    begin
        Buy ("EntryLong") 1 contracts next bar at (high + 2*tickval) stop;
    end;

    if ( CanGoShort ) then
    begin
        SellShort ("EntryShort") 1 contracts next bar at (low - 2*tickval) on stop;
    end;
end;
As I understand, entry stop order should be canceled if it is not filled and new bar come? If it is not true, then how to cancel it?

I will be very obligated to you for help.

Thank you in advance.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
NexusFi Journal Challenge - May 2024
Feedback and Announcements
Trade idea based off three indicators.
Traders Hideout
Quant vue
Trading Reviews and Vendors
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
  #2 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,666 since Jul 2012
Thanks Given: 1,892
Thanks Received: 7,359

That is true, it should be cancelled if not filled on the bar in question.

BUT, here is a dumb question...

Are you sure that CanGoLong and the other conditions are still not true? You might want to debug it using the Print statement, just to make sure the condition is really false.

Follow me on Twitter Reply With Quote
  #3 (permalink)
alexfdv
Ocean City MD/USA
 
Posts: 5 since Jan 2013
Thanks Given: 0
Thanks Received: 0



kevinkdog View Post
That is true, it should be cancelled if not filled on the bar in question.

BUT, here is a dumb question...

Are you sure that CanGoLong and the other conditions are still not true? You might want to debug it using the Print statement, just to make sure the condition is really false.

Yes, when I send order I print message:
"Entry Long/Short"

When position is flat, I print message:
" --- "

When MarketPosition <> 0, I print message:
"Try to exit"

So in the logs I see next situation:

Entry Long/Short
---
---
---
---
Try to exit



Reply With Quote
  #4 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,666 since Jul 2012
Thanks Given: 1,892
Thanks Received: 7,359

What about TimeCondition and CanGoLong?

Try this before your code shown:

var: bl (" ");

print (date,bl,time,bl,Marketposition,bl,TimeCondition,bl,CanGoLong,bl,CangoShort);


and compare that to when the order is placed, and when it should be cancelled.

Follow me on Twitter Reply With Quote
  #5 (permalink)
alexfdv
Ocean City MD/USA
 
Posts: 5 since Jan 2013
Thanks Given: 0
Thanks Received: 0


kevinkdog View Post
What about TimeCondition and CanGoLong?

Try this before your code shown:

var: bl (" ");

print (date,bl,time,bl,Marketposition,bl,TimeCondition,bl,CanGoLong,bl,CangoShort);


and compare that to when the order is placed, and when it should be cancelled.

Ok, did it. Log is the next:

13:59:09.000;Entry Long at high + 2 ticks = 879,499987792969

13:59:09.000; 1130116 1359 0 1 True False

14:37:50.000; 1130116 1437 0 1 False False

15:10:11.000; 1130116 1509 0 1 False False

15:39:48.000; 1130116 1539 0 1 False False

16:13:42.000; 1130116 1613 1 1 False False

16:29:58.000; 1130116 1629 1 1 False False

16:31:04.000; 1130116 1631 1 1 False False

16:32:47.000; 1130116 1632 1 1 False False

Time in bold - it is when Market position is 0 and entry conditions is False. After that time we can see that MarketPosition is 1

Reply With Quote
  #6 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,666 since Jul 2012
Thanks Given: 1,892
Thanks Received: 7,359

It looks like you are using a non-time based bar type. MAYBE that has something to do with it.

I looked on Tradestation forum, and found this (which confirms your thinking):

> What is the lifespan of the stop order? If I do not issue it on each bar, will it then cease to exist?

You need to issue built-in stop orders on each bar to provide entry bar protection ( to allow exits on the same bar as entry ), even if you are not in a position, or they will be cancelled the next bar after your strategy stops issuing them.




So, the way I see it, your order should have been cancelled when "CANGOLONG" turns to false.

If I find out anymore, I will post it. You might also try posting this on TS forum.

Sorry I could not fix this issue for you.

Follow me on Twitter Reply With Quote
  #7 (permalink)
alexfdv
Ocean City MD/USA
 
Posts: 5 since Jan 2013
Thanks Given: 0
Thanks Received: 0


kevinkdog View Post
It looks like you are using a non-time based bar type. MAYBE that has something to do with it.

I looked on Tradestation forum, and found this (which confirms your thinking):

> What is the lifespan of the stop order? If I do not issue it on each bar, will it then cease to exist?

You need to issue built-in stop orders on each bar to provide entry bar protection ( to allow exits on the same bar as entry ), even if you are not in a position, or they will be cancelled the next bar after your strategy stops issuing them.




So, the way I see it, your order should have been cancelled when "CANGOLONG" turns to false.

If I find out anymore, I will post it. You might also try posting this on TS forum.

Sorry I could not fix this issue for you.

Thank you for help I will continue looking for the solution...

Reply With Quote




Last Updated on January 16, 2013


© 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