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)
tracking each contract's profit target and stop loss
Hi, I'm running a simple program with Multicharts.
The basic logic is that I will first take a long position and after I'm in the money for about 50 points, I accumulate my position by taking another long position. I am having trouble setting an individual stop loss and profit target for each contract. Below is the code I wrote but with no success so far. I wonder if my logic is wrong. Feel free to comment. Thanks
code:
if condition then
buy (1st) at Market;
if current price - entryprice > 50 then
buy (2nd) at Market
if currentcontract =1 then
set profit1
set stop1
if currentcontract = 2 then
set profit1
set stop1
set profit2
set stop2
Can you help answer these questions from other members on NexusFi?
if condition1 then
begin
Buy ("Entry 1") 1 contract next bar at market;
end;
if MarketPosition * Current Shares =1 then
begin
Buy("Entry 2") 1 contract next bar at EntryPrice +50 Stop;
end;
if MarketPosition =1 then
begin
Sell from ("Entry 1") next bar at ProfitTarget1 Limit;
Sell from ("Entry 1") next bar at Stop1 Stop;
Sell from ("Entry 2") next bar at ProfitTarget2 Limit;
Sell from ("Entry 2") next bar at Stop2 Stop;
end;
With your current code you will be buying another contract for every 50 point profit...