NexusFi: Find Your Edge


Home Menu

 





GTC stops instead of Day orders... free code for percent targets DAY help make GTC


Discussion in EasyLanguage Programming

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




 
Search this Thread

GTC stops instead of Day orders... free code for percent targets DAY help make GTC

(login for full post details)
  #1 (permalink)
mslezak
Houston Texas
 
Posts: 1 since Jul 2013
Thanks Given: 0
Thanks Received: 0

Anyone know how to modify this code I wrote that uses EasyLanguage to place DAY orders based on percent targets to code that places Good Until Cancelled orders? It seems the function written for stops in EL doesn't allow this parameter, so another function is required. Has to be a One Cancels Other order... Don't want to have to rely on an internet connection being up, just want the stops in place as soon as the initial position is triggered. Posting free code here in exchange for some help...


Inputs: Price(Close), //use the closing price for calcs
Cts(3), //#contracts for each trade
Notional(5000), //default per contract units (5000 bushels corn/ soybeans / wheat etc.)
StopLossPct(0.02), // 2% target, change to your liking
ProfitTgtPct(0.02); // 2% target

Vars:
PrcStopLessEntryPrice(StopLossPct*Cts*Notional), PrcPrfLessEntryPrice(ProfitTgtPct*Cts*Notional), StpLoss(0), PrfTgt(0);

// YOUR CODE HERE THAT DOES SOME BUY OR SELL BASED ON SOMETHING....
StpLoss = PrcStopLessEntryPrice * Price[0];
PrfTgt= PrcPrfLessEntryPrice * Price[0];

SetStopPosition;
SetStopLoss(StpLoss);
SetProfitTarget(PrfTgt);

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Volume profile TradeStation
EasyLanguage Programming
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Request for MACD with option to use different MAs for fa …
NinjaTrader
Trader Dale [email protected] or Scammer Dale
Trading Reviews and Vendors
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
GFIs1 1 DAX trade per day journal
28 thanks
Supertradersams Thread Journal on NQ/MNQ
18 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)
 kevinkdog   is a Vendor
 
Posts: 3,635 since Jul 2012
Thanks Given: 1,880
Thanks Received: 7,299



mslezak View Post
Anyone know how to modify this code I wrote that uses EasyLanguage to place DAY orders based on percent targets to code that places Good Until Cancelled orders? It seems the function written for stops in EL doesn't allow this parameter, so another function is required. Has to be a One Cancels Other order... Don't want to have to rely on an internet connection being up, just want the stops in place as soon as the initial position is triggered. Posting free code here in exchange for some help...


Inputs: Price(Close), //use the closing price for calcs
Cts(3), //#contracts for each trade
Notional(5000), //default per contract units (5000 bushels corn/ soybeans / wheat etc.)
StopLossPct(0.02), // 2% target, change to your liking
ProfitTgtPct(0.02); // 2% target

Vars:
PrcStopLessEntryPrice(StopLossPct*Cts*Notional), PrcPrfLessEntryPrice(ProfitTgtPct*Cts*Notional), StpLoss(0), PrfTgt(0);

// YOUR CODE HERE THAT DOES SOME BUY OR SELL BASED ON SOMETHING....
StpLoss = PrcStopLessEntryPrice * Price[0];
PrfTgt= PrcPrfLessEntryPrice * Price[0];

SetStopPosition;
SetStopLoss(StpLoss);
SetProfitTarget(PrfTgt);


I'm almost positive that you cannot create GTC orders using automated code with SetStopLoss, SetProfitTarget. They are just day orders for that bar, unless the next bar cancels them or reaffirms them.

A couple of possible alternatives:

Use macros in your code to send the orders

Use PSP Order Ticket object (new programming in TS 9.0)


Unfortunately, I have no experience in either of the above.

Follow me on Twitter Reply With Quote





Last Updated on August 6, 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