NexusFi: Find Your Edge


Home Menu

 





help with strategy


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one niki with 3 posts (0 thanks)
    2. looks_two sam028 with 1 posts (1 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 zeller4 with 1 posts (0 thanks)
    1. trending_up 2,719 views
    2. thumb_up 1 thanks given
    3. group 3 followers
    1. forum 6 posts
    2. attach_file 1 attachments




 
Search this Thread
  #1 (permalink)
 niki 
wokolina
 
Experience: None
Platform: ninjatrader
Posts: 4 since Mar 2010
Thanks Given: 0
Thanks Received: 1

hi, I am not good with coding and what I looking for to figure out is how to develop a strategy where I can put SMA + some range
eg
 
Code
                            
protected override void Initialize()
 { 
  
SetProfitTarget ("", CalculationMode.Ticks4); 
 
SetStopLoss ("", CalculationMode.Ticks2); 
 
CalculateOnBarClose false
 } 
    
SMA(close4)
 if ( 
price_is_above_SMA_5_ticks 
 {  
enterlong;  //only one time, if price pullback (one tick because second is SL) and cross the fifth tick from SMA again, no more opening position 
  
}
 if ( 
price_is_bellow_SMA_5_ticks 
 {  
entershort//only one time  


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
CFTC Approves First US Bitcoin Perpetual Futures -- Kals …
Traders Hideout
June 15 Peace Odds Surge From 3.6% to 12.25% After Trump …
Prediction Markets & Event Contracts
The June 15 Resolution Trap: Irans Agreed Text Still Pri …
Prediction Markets & Event Contracts
Four New E-mini Futures Launch June 29 -- Russell 3000, …
Emini and Emicro Index
CME Raises Energy Futures Margins After Iran-War Volatil …
Commodities
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
8 thanks
Darmok and Jalad at Tanagra
1 thanks
  #3 (permalink)
 zeller4 
Orlando Florida
 
Experience: Intermediate
Platform: NT8
Trading: CL, NQ, ES, RTY
Posts: 478 since Jun 2009
Thanks Given: 1,419
Thanks Received: 404


Hey Niki,

Not exactly sure how to interpret your request...

Two thoughts to help move it along:

1. Post a screenshot with markups to identify what you mean by this:

Quoting 
//only one time, if price pullback (one tick because second is SL) and cross the fifth tick from SMA again, no more opening position

2. Check out the SampleMACrossover strats on the Ninjatrader forum website and see if that could be altered to accomplish what you want.

kz


Reply With Quote
  #4 (permalink)
 niki 
wokolina
 
Experience: None
Platform: ninjatrader
Posts: 4 since Mar 2010
Thanks Given: 0
Thanks Received: 1

it looks like that


Attached Thumbnails
Click image for larger version

Name:	long_short.jpg
Views:	223
Size:	36.3 KB
ID:	11417  
Started this thread Reply With Quote
  #5 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,758 since Jun 2009
Thanks Given: 3,828
Thanks Received: 4,644

I'm not sure to understand the question, but if you want to avoid reversing your positions after each opposite signal, the idea is maybe to do something like:
 
Code
                            
 if ( ( price_is_above_SMA_5_ticks ) && (Position.MarketPosition == MarketPosition.Flat) ) {
enterlong ;
}

if ( ( 
price_is_below_SMA_5_ticks ) && (Position.MarketPosition == MarketPosition.Flat) ) {
 
entershort ;


Success requires no deodorant! (Sun Tzu)
Reply With Quote
Thanked by:
  #6 (permalink)
 eman 
Galveston ,TX
 
Experience: Intermediate
Platform: NT7
Broker: Zaner
Trading: Futures
Posts: 386 since Mar 2010
Thanks Given: 364
Thanks Received: 435

if you're asking for the "formula" to express price_is_above_SMA_5_ticks, try this:
 
Code
if (Close[0] > SMA(Close,4) + 5 * TickSize)
cheers,
-e


Reply With Quote
  #7 (permalink)
 niki 
wokolina
 
Experience: None
Platform: ninjatrader
Posts: 4 since Mar 2010
Thanks Given: 0
Thanks Received: 1


eman View Post
if you're asking for the "formula" to express price_is_above_SMA_5_ticks, try this:
 
Code
if (Close[0] > SMA(Close,4) + 5 * TickSize)
cheers,
-e

yes, that what I'm looking for, I found it on ninja forum but anyway thx.


Started this thread Reply With Quote




Last Updated on April 27, 2010


© 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