Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
GTC stops instead of Day orders... free code for percent targets DAY help make GTC
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
// YOUR CODE HERE THAT DOES SOME BUY OR SELL BASED ON SOMETHING....
StpLoss = PrcStopLessEntryPrice * Price[0];
PrfTgt= PrcPrfLessEntryPrice * Price[0];
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.