NexusFi: Find Your Edge


Home Menu

 





tracking each contract's profit target and stop loss


Discussion in MultiCharts

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




 
Search this Thread
  #1 (permalink)
sunsun
hong kong
 
Posts: 6 since May 2013
Thanks Given: 1
Thanks Received: 1

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


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
requesting .nrd replay files from 2026 spy and qqq
The Elite Circle
Trump Media to sell instant access to market-moving soci …
Traders Hideout
EA
Platforms and Indicators
No book, only a stair: journaling fills where price move …
Cryptocurrency
Datafeed for Atas
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Mes vs MNQ
6 thanks
NexusFi site changelog and issues/problem reporting
5 thanks
BERN ALGOS algo trading journal
3 thanks
Johnnys Journal
2 thanks
TopStep Trader disappointment
2 thanks
  #2 (permalink)
 quantarb 
Wayne, NJ USA
 
Experience: Intermediate
Platform: Multicharts, Deltix DCS
Broker: Interactive Brokers/IQ Feed
Trading: ETF Options
Posts: 41 since Oct 2012
Thanks Given: 7
Thanks Received: 38


sunsun View Post
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


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...


Reply With Quote
Thanked by:




Last Updated on May 6, 2013


© 2026 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 - Downloads - Top
no new posts