NexusFi: Find Your Edge


Home Menu

 





tracking each contract's profit target and stop loss


Discussion in MultiCharts

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




 
Search this Thread

tracking each contract's profit target and stop loss

  #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?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
About a successful futures trader who didnĀ“t know anyth …
Psychology and Money Management
What broker to use for trading palladium futures
Commodities
MC PL editor upgrade
MultiCharts
Cheap historycal L1 data for stocks
Stocks and ETFs
 
  #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


© 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