SetProfitTarget() doesn't work! - MultiCharts | futures io social day trading
futures io futures trading


SetProfitTarget() doesn't work!
Updated: Views / Replies:107 / 2
Created: by hgchcw Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 100,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

SetProfitTarget() doesn't work!

  #1 (permalink)
Hong Kong + Hong Kong
 
Trading Experience: Intermediate
Platform: Multicharts
Favorite Futures: US stocks, Currency
 
Posts: 10 since Feb 2019
Thanks: 6 given, 0 received

SetProfitTarget() doesn't work!

I have written a signal to set profit target at 12% of the entire open position. The following is part of the codes to calculate the average price and total no of shares of all opened position. I have printed the output, and have checked the average price and total no of shares are calculated correctly.

However the problem is (1) even if the OpenPositionProfit is smaller than the target, it also sell all the shares.
(2) I have tried to change the profit target to 20%, ie. target = APrice*TTSize*0.12;, it never
sell the shares.

if Date[1] = BuyDate then begin
TTPrice = 0;
TTSize = 0;
posAgo = 0;
numOfTrades = PosTradeCount(posAgo); // get the number of trades for that position
for value1 = 0 to (numOfTrades - 1) begin
TTPrice = TTPrice + PosTradeEntryPrice(posAgo, value1);
TTSize = TTSize + PosTradeSize(posAgo, value1);
end;
APrice = TTPrice / PosTradeCount(posAgo);
target = APrice*TTSize*0.12;
setstopposition;
SetProfitTarget(target);
end;


Thanks for your help,
Raymond

Reply With Quote
 
  #2 (permalink)
Legendary  Vendor: www.abctradinggroup.com 
Hamburg Germany
 
Trading Experience: Advanced
Platform: Multicharts, Tradestation
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 2,029 since Apr 2013
Thanks: 356 given, 1,279 received

Hi Raymond,

this is most likely caused by the code. You will have to check what value you are exactly computing as target and compare this to where the target is executed.
Besides that you are placing the SetProfitTarget within a date condition i.e. it would not be issued outside this condition anymore.

Regards,

ABCTG

Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #3 (permalink)
Albufeira, Algarve, Portugal
 
Trading Experience: Intermediate
Platform: TradeStation,Sierra Chart
Broker/Data: Tradestation Securities
Favorite Futures: VX, my kids
 
vmodus's Avatar
 
Posts: 246 since Feb 2017
Thanks: 399 given, 387 received


Hello Raymond,

As ABCTG mentioned, put you target outside the 'if' statement. My partner ran into the same problem as you a while back. Here is what your code should look like (using your sample):

 
Code
if Date[1] = BuyDate then begin
TTPrice = 0;
TTSize = 0;
posAgo = 0;
numOfTrades = PosTradeCount(posAgo); // get the number of trades for that position
for value1 = 0 to (numOfTrades - 1) begin
TTPrice = TTPrice + PosTradeEntryPrice(posAgo, value1);
TTSize = TTSize + PosTradeSize(posAgo, value1);
end;
APrice = TTPrice / PosTradeCount(posAgo);
target = APrice*TTSize*0.12;
end;

// Stop position outside your 'if' statement
   setstopposition;
   SetProfitTarget(target);
-vmodus


Last edited by vmodus; March 6th, 2019 at 08:41 PM. Reason: clarification
Reply With Quote

Reply



futures io > > > > SetProfitTarget() doesn't work!

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)
 

futures io is celebrating 10-years w/ over $18,000 in prizes!

Right now
 

Thanks for everything -- $250 in Amazon Gift Cards ready to give away

Right now
 

Journal in July -- over $2,500 in prizes w/NinjaTrader

July
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
supertrend u11 doesn't work sound alert palmera75 NinjaTrader 8 July 16th, 2017 06:37 PM
Unirenko doesn't work as added dataseries Loki45 NinjaTrader 1 October 30th, 2015 05:11 PM
SetProfitTarget() Delay? Possible? Momozo NinjaTrader Programming 3 July 28th, 2014 12:42 PM
Setstoploss & Setprofittarget eddysmc MultiCharts 3 November 11th, 2013 02:48 PM
SetProfitTarget only if my condition is true Ironman9973 NinjaTrader Programming 2 November 20th, 2012 03:36 AM


Tags
abc, average, code, multicharts, profit target, sample, setprofittarget, signal, size

All times are GMT -4. The time now is 07:39 PM. (this page content is cached, log in for real-time version)

Copyright © 2019 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432 WhatsApp Business, info@futures.io
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.
no new posts
Page generated 2019-06-24 in 0.19 seconds with 14 queries on phoenix