NexusFi: Find Your Edge


Home Menu

 





Setting a static profit target


Discussion in NinjaTrader

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




 
Search this Thread
  #1 (permalink)
 
toddma's Avatar
 toddma 
vancouver canada
 
Experience: Intermediate
Platform: multicharts, ninjatrader
Trading: forex
Posts: 53 since Jul 2012
Thanks Given: 14
Thanks Received: 6

Does anyone know of a way to have an exit signal based on the bar that caused the entry signal?

For example:
If the bar that caused the entry signal was size A (close minus open) then set the profit target equal to size B (open minus close * 2) of that specific bar though. That is the key, I have it so that it moves along looking at the last bar and doing that calculation, however, I need it to fix on the original bar.

Any ideas?
Thanks in advance


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Iran and Israel Stand Down: What $9M in Peace Contracts …
Prediction Markets & Event Contracts
April CPI Preview: +3.7% YoY Expected at 8:30 AM ET -- C …
Traders Hideout
Irans Dual Probability: Guns Quiet at 99.95% While Forma …
Prediction Markets & Event Contracts
Warsh Opens Today, Hormuz June 19 -- WTI Below $80, Fran …
Prediction Markets & Event Contracts
Would a node-based workflow for automated trading be useful?
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
10 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks
  #2 (permalink)
 vegasfoster 
las vegas
 
Experience: Intermediate
Platform: Sierra Chart
Broker: Velocity/IB
Trading: 6E
Posts: 1,145 since Feb 2010
Thanks Given: 304
Thanks Received: 845

Forgetting my ninjascript, but maybe try something like,


target.Set(Position.MarketPosition = MarketPosition.Flat ? (math.abs(Open[0] - Close[0])*2)/TickSize : target[1]);
SetProfitTarget("LongSignal", CalculationMode.Ticks, target[0]);


Logic being the target will continually update until you enter a position, presumably at bar open, then target will keep referring to the prior target figure until the position is closed. Anyone feel free to correct me if that is wrong or better way to do it.


Reply With Quote
Thanked by:
  #3 (permalink)
 
toddma's Avatar
 toddma 
vancouver canada
 
Experience: Intermediate
Platform: multicharts, ninjatrader
Trading: forex
Posts: 53 since Jul 2012
Thanks Given: 14
Thanks Received: 6


Apologies - this is quite a bit over my head at the moment. The scripts that I am writing are a lot simpler.
Do I replace the SetProfitTarget line with this? If so I am getting the following errors:

The name "math" does not exist
The name "target" does not exist

Or do I need to define the following terms somewhere?
Thank a lot for your help,
Todd


Started this thread Reply With Quote
  #4 (permalink)
 
josh's Avatar
 josh 
Georgia, US
 
Experience: None
Platform: SC
Broker: Denali+Teton
Trading: ES, NQ, YM
Posts: 6,331 since Jan 2011
Thanks Given: 6,955
Thanks Received: 18,632


toddma View Post
Does anyone know of a way to have an exit signal based on the bar that caused the entry signal?

For example:
If the bar that caused the entry signal was size A (close minus open) then set the profit target equal to size B (open minus close * 2) of that specific bar though. That is the key, I have it so that it moves along looking at the last bar and doing that calculation, however, I need it to fix on the original bar.

Any ideas?
Thanks in advance

A question on the logic: the market knows of no such thing as "bars" or "candles" -- so, why would you set your stop or profit target based on it?


Reply With Quote
  #5 (permalink)
 
toddma's Avatar
 toddma 
vancouver canada
 
Experience: Intermediate
Platform: multicharts, ninjatrader
Trading: forex
Posts: 53 since Jul 2012
Thanks Given: 14
Thanks Received: 6

The strategy is very short term in nature. It is only concerned with the most recent level of volatility and it should complete within 1-3 bars after the trade takes place (ideally). If we're in the middle of a strong move the target should be larger, if we're in a consolidation phase the target may be very small.


Started this thread Reply With Quote




Last Updated on July 31, 2012


© 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