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)
Could someone please copy and paste the code from SampleAdvancedAutomatedStrat to my ThreeBarsLONG strategy? I have tried and tried but I can't get it to ever compile. I know the ThreeBarsLONG strategy is simple and probably not really good (more for example than anything) but I am trying to learn a little and if I could see where the code should be placed and the right way to do it I think I would understand what I'm doing wrong. I will attach both strategies below plus paste the code I'm trying to use. If anyone wants to take the time to look at it for me......THANK YOU!
protected override void OnBarUpdate()
{
// After our strategy has a PnL greater than $1000 or less than -$400 we will stop our strategy
if (Performance.AllTrades.TradesPerformance.Currency.CumProfit > 1000
|| Performance.AllTrades.TradesPerformance.Currency.CumProfit < -400)
{
/* A custom method designed to close all open positions and cancel all working orders will be called.
This will ensure we do not have an unmanaged position left after we halt our strategy. */
StopStrategy();
// Halt further processing of our strategy
return;
}
// Checks to see if the day of the week is Saturday or Sunday. Only allows trading if the day of the week is not Saturday or Sunday.
if (Time[0].DayOfWeek != DayOfWeek.Saturday && Time[0].DayOfWeek != DayOfWeek.Sunday)
{
/* Checks to see if the time is during the following hours (format is HHMMSS or HMMSS).
The timezone used here is (GMT-05:00) EST. */
if ((ToTime(Time[0]) >= 101500 && ToTime(Time[0]) <= 151500)) //|| (ToTime(Time[0]) >= 140000 && ToTime(Time[0]) < 154500))
{
if (Historical) return;
Can you help answer these questions from other members on NexusFi?