NexusFi: Find Your Edge


Home Menu

 





Current contract


Discussion in EasyLanguage Programming

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




 
Search this Thread

Current contract

  #1 (permalink)
 montanajtt 
Como, Italy
 
Experience: Advanced
Platform: Tradestation, IB
Broker: Tradestation, IB
Trading: ES
Frequency: Daily
Duration: Minutes
Posts: 184 since Aug 2014
Thanks Given: 299
Thanks Received: 312

Hello,

after a couple of months I'm running the strategy today happened that, I think due to several platform disconnections, the strategy continued to send to market closing orders like if it didn't recognize they already were sent before.
So at the end instead of find myself long 1 contract I was long 3 contracts with only 1 contract to close the position at target. (yes I was not there, it happened during the nigh and I was sleeping)

It's the first time it happens but platform disconected several times and I never had this kind of problem before...maybe is due to the fact I'm using the 9.5...

anyway in order to prevent such thing again I was thinking to use some kind of protection but I need help to code the variable...and even if figure out something I still have some doubt if can work...can you help?

vars : cont(0) ;


cont = currentcontract ....I should assign a value to this var consider I have no overnight positions.

if currentcontracts > 1 then begin
sell (currentcontract - cont) contract this bar at close ;
end;

Thanks for your help!

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Exit Strategy
NinjaTrader
Better Renko Gaps
The Elite Circle
Trade idea based off three indicators.
Traders Hideout
REcommedations for programming help
Sierra Chart
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
48 thanks
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,628


montanajtt,

you might want to look at the GetPositionQuantity reserved word. This will provide you with the position for a symbol and side (long/short) for the account of choice.
As TS says it might have some issues and is processor intensive, you might want to check the GetPosProvQty function. You can obtain it from the official forums.

Regards,
ABCTG

Follow me on Twitter Reply With Quote
  #4 (permalink)
 montanajtt 
Como, Italy
 
Experience: Advanced
Platform: Tradestation, IB
Broker: Tradestation, IB
Trading: ES
Frequency: Daily
Duration: Minutes
Posts: 184 since Aug 2014
Thanks Given: 299
Thanks Received: 312


ABCTG View Post
montanajtt,

you might want to look at the GetPositionQuantity reserved word. This will provide you with the position for a symbol and side (long/short) for the account of choice.
As TS says it might have some issues and is processor intensive, you might want to check the GetPosProvQty function. You can obtain it from the official forums.

Regards,
ABCTG


Hi ABCTG,

yes defenitely this can be a solution.

Thank you

Started this thread Reply With Quote




Last Updated on August 7, 2014


© 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