NexusFi: Find Your Edge


Home Menu

 





Pre / Post Increment Operands


Discussion in NinjaTrader

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




 
Search this Thread

Pre / Post Increment Operands

  #1 (permalink)
 resirca52009 
Indianapolis, Indiana/ USA
 
Experience: Advanced
Platform: MT4, Ninjatrader
Broker: AMP / CQG
Trading: Futures
Posts: 64 since Oct 2012
Thanks Given: 112
Thanks Received: 35

What I am trying to do in plain English is make the ATR profit target " dynamic " by
" incrementalizing " it. See code snippett below :

So, currently mFactor A / B = static values. Which means they have a stationary value based on whether or not the ATR value is above or below the benchmark value of .25. The ATR value is determined by the price, so as price goes up or down the ATR value will change correspondingly in turn causing the mFactor to change BUT ONLY if it goes ABOVE or goes BELOW the .25 value. What I am attempting to do is have the mFactor change ( increment or de increment if you will ) along with the change in the ATR value.

So, let's say for every five points of the declining ATR value the mFactor increases by 1 point. Or for every one point of ATR decline the mFactor increases by one point....hopefully this make sense.

mFactorA = ATR(14)[0];
mFactorB = ATR(14)[0];


if (mFactorA > .25 + + // AS THIS .25 VALUE INCREMENTS BY ONE
&& Open[0] <= ATRPREDICTOR2(2, 10, 3).Upper[0]
&& High[3] > High[2] // SHORT
&& High[2] > High[1])

if (mFactorB < .25 - - // AS THIS .25 VALUE DE INCREMENTS BY ONE
&& Open[0] <= ATRPREDICTOR2(2, 10, 3).Upper[0]
&& High[3] > High[2] // SHORT
&& High[2] > High[1])

{
EnterShort(DefaultQuantity, "Condition 7A Entry");
DrawDiamond("Sell Order Diamond # 7" + CurrentBar, true, 0, High[0] + 75 * TickSize, Color.Green);
mFactorA=((ATR(14)[0]/TickSize)* - - 2 ); // THEN THE 2 VALUE DE INCREMENTS BY ONE
SetProfitTarget("Condition 7A Entry", CalculationMode.Ticks,mFactorA);
}

{
EnterShort(DefaultQuantity, "Condition 7B Entry");
DrawDiamond("Sell Order Diamond # 7" + CurrentBar, true, 0, High[0] + 75 * TickSize, Color.PaleGreen);
mFactorB=((ATR(14)[0]/TickSize)* + + 3 ); // THEN THE 3 VALUE INCREMENTS BY ONE
SetProfitTarget("Condition 7B Entry", CalculationMode.Ticks,mFactorB);
}

Thanks,
Richard

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Exit Strategy
NinjaTrader
NexusFi Journal Challenge - April 2024
Feedback and Announcements
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
Online prop firm The Funded Trader (TFT) going under?
Traders Hideout
Build trailing stop for micro index(s)
Psychology and Money Management
 
  #2 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 3,003 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,863


resirca52009 View Post
What I am trying to do in plain English is make the ATR profit target " dynamic " by
" incrementalizing " it. See code snippett below :

So, currently mFactor A / B = static values. Which means they have a stationary value based on whether or not the ATR value is above or below the benchmark value of .25. The ATR value is determined by the price, so as price goes up or down the ATR value will change correspondingly in turn causing the mFactor to change BUT ONLY if it goes ABOVE or goes BELOW the .25 value. What I am attempting to do is have the mFactor change ( increment or de increment if you will ) along with the change in the ATR value.

So, let's say for every five points of the declining ATR value the mFactor increases by 1 point. Or for every one point of ATR decline the mFactor increases by one point....hopefully this make sense.

mFactorA = ATR(14)[0];
mFactorB = ATR(14)[0];


if (mFactorA > .25 + + // AS THIS .25 VALUE INCREMENTS BY ONE
&& Open[0] <= ATRPREDICTOR2(2, 10, 3).Upper[0]
&& High[3] > High[2] // SHORT
&& High[2] > High[1])

if (mFactorB < .25 - - // AS THIS .25 VALUE DE INCREMENTS BY ONE
&& Open[0] <= ATRPREDICTOR2(2, 10, 3).Upper[0]
&& High[3] > High[2] // SHORT
&& High[2] > High[1])

{
EnterShort(DefaultQuantity, "Condition 7A Entry");
DrawDiamond("Sell Order Diamond # 7" + CurrentBar, true, 0, High[0] + 75 * TickSize, Color.Green);
mFactorA=((ATR(14)[0]/TickSize)* - - 2 ); // THEN THE 2 VALUE DE INCREMENTS BY ONE
SetProfitTarget("Condition 7A Entry", CalculationMode.Ticks,mFactorA);
}

{
EnterShort(DefaultQuantity, "Condition 7B Entry");
DrawDiamond("Sell Order Diamond # 7" + CurrentBar, true, 0, High[0] + 75 * TickSize, Color.PaleGreen);
mFactorB=((ATR(14)[0]/TickSize)* + + 3 ); // THEN THE 3 VALUE INCREMENTS BY ONE
SetProfitTarget("Condition 7B Entry", CalculationMode.Ticks,mFactorB);
}

Thanks,
Richard

You would need to used the increment / decrement operators on variables, not on constants.

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #3 (permalink)
 resirca52009 
Indianapolis, Indiana/ USA
 
Experience: Advanced
Platform: MT4, Ninjatrader
Broker: AMP / CQG
Trading: Futures
Posts: 64 since Oct 2012
Thanks Given: 112
Thanks Received: 35



rleplae View Post
You would need to used the increment / decrement operators on variables, not on constants.

rleplae,

Again, thanks for your reply. Could you offer an example ? A link, a document, any other resources ? I have been researching random walk with drift theory, maximal curves, continuous stochastic processes, measure & integration, probabilities and discrete intervals in an attempt to find a way to achieve my goal here of having a dynamic stop loss and dynamic profit target. The one I currently use is somewhat dynamic but it could be much better. My goal is to have my stop loss and profit target "move and calculate" with the recent past ( say, the past 30 - 15 minute bars ) as well as the current price. I am basically trying to calculate volatility on a minute by minute basis and adjust my stop loss and profit target accordingly......say, in 15 minute intervals, if that happens to be the time frame that I am trading from.

Thanks,
Richard

Started this thread Reply With Quote
  #4 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 3,003 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,863


resirca52009 View Post
rleplae,

Again, thanks for your reply. Could you offer an example ? A link, a document, any other resources ?

Thanks,
Richard

In the attached file you will find examples where stop and target is dynamically moved...

good luck !

Attached Files
Elite Membership required to download: AlphaTradingMethodRonV36.cs
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #5 (permalink)
 resirca52009 
Indianapolis, Indiana/ USA
 
Experience: Advanced
Platform: MT4, Ninjatrader
Broker: AMP / CQG
Trading: Futures
Posts: 64 since Oct 2012
Thanks Given: 112
Thanks Received: 35

Thanks for the code example ! I'll spend some time reviewing.....

Started this thread Reply With Quote




Last Updated on January 26, 2016


© 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