NexusFi: Find Your Edge


Home Menu

 





Take profit at an offset moving average


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one jpthegreek1 with 2 posts (0 thanks)
    2. looks_two trendisyourfriend with 1 posts (1 thanks)
    3. looks_3 Chile with 1 posts (0 thanks)
    4. looks_4 blackgrey45 with 1 posts (0 thanks)
    1. trending_up 688 views
    2. thumb_up 1 thanks given
    3. group 4 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
Search this Thread

Take profit at an offset moving average

  #1 (permalink)
jpthegreek1
Charlotte North Carolina
 
Posts: 11 since Sep 2019
Thanks Given: 3
Thanks Received: 0

Is there a way to do a strategy that will take profit at the touch or within a certain percentage of an offset exponential moving average. Thank you so much everyone for your time

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trade idea based off three indicators.
Traders Hideout
How to apply profiles
Traders Hideout
MC PL editor upgrade
MultiCharts
Exit Strategy
NinjaTrader
REcommedations for programming help
Sierra Chart
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
21 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #2 (permalink)
 
blackgrey45's Avatar
 blackgrey45 
Marco Island, FL
Legendary Market Wizard
 
Experience: Beginner
Platform: Sierra Chart
Broker: AMP Global
Trading: MCL ES MES M6E MGC
Frequency: Several times daily
Duration: Minutes
Posts: 779 since Jul 2022
Thanks Given: 874
Thanks Received: 908

Yeah you can manually enter your orders when they hit the desired percentage/ema, but I am guessing you want to create an automated trading system for this strategy. There are lots of people on this forum that have created automated moving average strategies. Just search the forum and DM people with threads that look helpful. Sorry I couldn't be of more help, I still enter my orders manually lol.

Visit my NexusFi Trade Journal Reply With Quote
  #3 (permalink)
 Chile 
Boston Massachusetts
 
Experience: Intermediate
Platform: NinjaTrader
Trading: Emini ES, Crude CL, Gold GC
Posts: 31 since Dec 2015
Thanks Given: 8
Thanks Received: 14


LET US KNOW HOW YOU MAKE OUT I AM INTERESTED IN THE ANSWER ALSO.

THANKS I AM SURE IT CAN BE DONE.

Reply With Quote
  #4 (permalink)
 
trendisyourfriend's Avatar
 trendisyourfriend 
Quebec Canada
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG
Trading: ES, NQ, YM
Frequency: Daily
Duration: Minutes
Posts: 4,527 since Oct 2009
Thanks Given: 4,175
Thanks Received: 6,020


jpthegreek1 View Post
Is there a way to do a strategy that will take profit at the touch or within a certain percentage of an offset exponential moving average. Thank you so much everyone for your time

That's the formula i would use to create an upper/lower bands around a moving average and would attach the take profit order to one of the bands depending on the direction of your trade:

 
Code
    // Define the length of the moving average
    int maLength = 20; // You can adjust this as needed

    // Calculate the moving average
    double movingAverage = SMA(maLength)[0];

    // Define the percentage for the bands
    double percentage = 5.0; // 5% for a 5% difference

    // Calculate the upper band
    double upperBand = movingAverage * (1 + (percentage / 100));

    // Calculate the lower band
    double lowerBand = movingAverage * (1 - (percentage / 100));

Reply With Quote
Thanked by:
  #5 (permalink)
jpthegreek1
Charlotte North Carolina
 
Posts: 11 since Sep 2019
Thanks Given: 3
Thanks Received: 0


trendisyourfriend View Post
That's the formula i would use to create an upper/lower bands around a moving average and would attach the take profit order to one of the bands depending on the direction of your trade:

 
Code
    // Define the length of the moving average
    int maLength = 20; // You can adjust this as needed

    // Calculate the moving average
    double movingAverage = SMA(maLength)[0];

    // Define the percentage for the bands
    double percentage = 5.0; // 5% for a 5% difference

    // Calculate the upper band
    double upperBand = movingAverage * (1 + (percentage / 100));

    // Calculate the lower band
    double lowerBand = movingAverage * (1 - (percentage / 100));

Thank you for this!!! Can it take profit and immediately go short?

Reply With Quote




Last Updated on August 31, 2023


© 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