Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
you must be right! I added this extra line for myself
if (Position.MarketPosition == MarketPosition.Flat){
EnterLong(1);
Print("RIGHT HERE NERD: " + Position.AveragePrice);
Baseprice = Position.AveragePrice;
and sure enough it showed up 0 haha, I'll read that section of the help you suggested and post back what I figure out, thanks!
Can you help answer these questions from other members on NexusFi?
I am now having another issue - I was backtesting on the usdjpy pair and specifically on jan 7th 2016 around 8:16pm it hit a sort of error when the market was moving really fast where the logic in the code doesn't seem to be followed, but in the tick by tick play by play in the output I don't understand why its doing what it is if another set of eyes could point me in the right direction that would be awesome, thanks
code:
#region Using declarations
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Gui;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Gui.SuperDom;
using NinjaTrader.Gui.Tools;
using NinjaTrader.Data;
using NinjaTrader.NinjaScript;
using NinjaTrader.Core.FloatingPoint;
using NinjaTrader.NinjaScript.Indicators;
using NinjaTrader.NinjaScript.DrawingTools;
#endregion
//This namespace holds Strategies in this folder and is required. Do not change it.
namespace NinjaTrader.NinjaScript.Strategies
{
public class ThirdTest : Strategy
{
private double Baseprice;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"3";
Name = "ThirdTest";
Calculate = Calculate.OnEachTick;
IsUnmanaged = false;
EntriesPerDirection = 1;
EntryHandling = EntryHandling.AllEntries;
IsExitOnSessionCloseStrategy = false;
ExitOnSessionCloseSeconds = 30;
IsFillLimitOnTouch = false;
MaximumBarsLookBack = MaximumBarsLookBack.Infinite;
OrderFillResolution = OrderFillResolution.High;
OrderFillResolutionType = BarsPeriodType.Minute;
OrderFillResolutionValue = 1; Slippage = 0;
StartBehavior = StartBehavior.ImmediatelySubmitSynchronizeAccount;
TimeInForce = TimeInForce.Gtc;
TraceOrders = true;
RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
StopTargetHandling = StopTargetHandling.PerEntryExecution;
BarsRequiredToTrade = 0;
// Disable this property for performance gains in Strategy Analyzer optimizations
// See the Help Guide for additional information
IsInstantiatedOnEachOptimizationIteration = true;
Piplength = 0.1;
Baseprice = 120.00;
}
else if (State == State.Configure)
{
}
}
I see that but I don't understand why the orders are invalid/being rejected. The goal of that line is to enter or modify the stop order to reverse my position, it is supposed to trail behind the position using the baseprice piplength calculation, instead of trailing with every pip/tenthpip I want it to make 10 pip jumps but only when the price gets 10 pips further away from the order, thanks