Dark
Theme
Light
Theme
Register
Username or Email
Username or Email
Password
Password
Forgot
Signup
Forgot
Browse
Register
Downloads / Indicators
Articles
Upgrade to Elite
Unanswered Posts
My Posts
Return to Homepage
Today's Posts
Trading Reviews and Vendors
Futures Brokers Reviews
Traders Hideout (general)
Platforms and Indicators
Trading Journals
Elite Trading Journals
Psychology and Money Management
Off-Topic
The Elite Circle
Webinars
Trading Articles
Main Trading Articles Index
Article Categories
Help, Tutorials, How-To's
Traders and Trading Methods
Platforms, Tools and Indicators
Terms (Glossary)
Article Tools
List New Articles
List Recent Article Changes
Random Article
Most Popular Articles
Category Groupings
Wanted Articles
Most Linked to from Forum
Go to Page...
Home
>
Info
Full content requires Elite Membership, the below is only a preview of the first post in the discussion.
Programming Conditionals & Exit x Bars after Entry
A little help appreciated - in advance.
1. Need to include a conditional a conditional like the one below in the following conditional.
LowestBar(CCI(14), 7) == 0 ? 1 : .......
in this piece of code:
&& (((MIN(CCI(14), 7)[0] - CCI(14)[0]) -
(MIN(CCIHSPower(28), 7)[0] - CCIHSPower(28)[0]))
/LowestBar(CCI(14), 7)) *-1
>= 14
Sure for someone with programming experience, this is laughable. And - am just learning.
2. Would like to modify this order code - from one of mike's demo, to use trailing stops instead of stop loss (understand we can not do both) .
2a. Exit the trade after 5 bars if not filled.
2b. Wait 2 or more bars after exit before next entry
protected override void Initialize()
{
CalculateOnBarClose = true;
EntryHandling = EntryHandling.UniqueEntries;
}
private void GoLong()
{
SetStopLoss("target1", CalculationMode.Price, Close[0] - (Stop * TickSize), false);
SetStopLoss("target2", CalculationMode.Price, Close[0] - (Stop * TickSize), false);
SetStopLoss("target3", CalculationMode.Price, Close[0] - (Stop * TickSize), false);
SetProfitTarget("target1", CalculationMode.Price, Close[0] + (Target1*TickSize));
SetProfitTarget("target2", CalculationMode.Price, Close[0] + ((Target1 + Target2)*TickSize));
SetProfitTarget("target3", CalculationMode.Price, Close[0] + ((Target1 + Target2 + Target3)*TickSize));
EnterLong("target1");
EnterLong("target2");
if(atarget3on)EnterLong("target3");
}
private void GoShort()
{
SetStopLoss("target1", CalculationMode.Price, Close[0] + (Stop*TickSize), false);
SetStopLoss("target2", CalculationMode.Price, Close[0] + (Stop*TickSize), false);
SetStopLoss("target3", CalculationMode.Price, Close[0] + (Stop*TickSize), false);
// SetTrailStop("target3", CalculationMode.Ticks, +19, false);
SetProfitTarget("target1", CalculationMode.Price, Close[0] - (Target1*TickSize));
SetProfitTarget("target2", CalculationMode.Price, Close[0] - ((Target1 + Target2)*TickSize));
SetProfitTarget("target3", CalculationMode.Price, Close[0] - ((Target1 + Target2 + Target3)*TickSize));
EnterShort("target1");
EnterShort("target2");
if(atarget3on) EnterShort("target3");
}
private void ManageOrders()
{
if(Position.MarketPosition == MarketPosition.Long)
{
if (BE2 && High[0] > Position.AvgPrice + (Target1 *TickSize))
SetStopLoss("target2", CalculationMode.Price, (Position.AvgPrice +((int) 2 * TickSize)), false);
if (BE3 && High[0] > Position.AvgPrice + (Target1 * TickSize))
SetStopLoss("target3", CalculationMode.Price, (Position.AvgPrice +((int) 2 * TickSize)), false);
}
if(Position.MarketPosition == MarketPosition.Short)
{
if (BE2 && Low[0]
Click to create a user account
Already have an account? Sign in
Log in
User Name or Email:
Password:
Forgotten Your Password?
futures io is now NexusFi
Trading Webinars How-to's
Trading Reviews & Products
Join Markets Chat waitlist
NinjaTrader Brokerage (Broker)
Ninja Mobile Trader (Server Hosting)
Apex Trader Funding (Prop Trading)
Tradovate (Trading Platform)
NinjaTrader (Trading Platform)
SharkIndicators (Trading Software)
© 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.
no new posts