Adding daily profit & daily loss targets to code - futures io
futures io



Adding daily profit & daily loss targets to code


Discussion in EasyLanguage Programming

Updated
    1. trending_up 3,472 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 150,000 members
  • 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 and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Adding daily profit & daily loss targets to code

(login for full post details)
  #1 (permalink)
yeli
Milano, Italy
 
 
Posts: 4 since Apr 2021
Thanks: 44 given, 0 received

Dear friends
Please help a newbie here - am trying to add dailyprofittarget and dailyloss to a simple moving average cross strat.. I added a dailyprofit/loss code that Big Mike posted a long time ago here...what's wrong there?

Thanks for ANY help!

This is the code:



// for use in signal
inputs:
dailyprofit(500),
dailyloss(250);

vars:
todaynet(0),
yesterdaynet(0);

if date <> date[1] then begin
yesterdaynet = NetProfit;
end;

if MarketPosition = 0 then begin
todaynet = NetProfit - yesterdaynet;
end;

condition1 = -dailyloss < todaynet and todaynet < dailyprofit;

// entries

if condition 1 then begin


inputs:
FastPrice( Close ) [DisplayName = "FastPrice", ToolTip =
"Enter an EasyLanguage expression to use in calculation of shorter length moving average."],
SlowPrice( Close ) [DisplayName = "SlowPrice", ToolTip =
"Enter an EasyLanguage expression to use in calculation of longer length moving average."],
FastLength( ) [DisplayName = "FastLength", ToolTip =
"Enter number of bars to use in calculation of shorter length moving average."],
SlowLength( ) [DisplayName = "SlowLength", ToolTip =
"Enter number of bars to use in calculation of longer length moving average."];

variables:
FastAvg( ),
SlowAvg( );

FastAvg = AverageFC( FastPrice, FastLength );
SlowAvg = AverageFC( SlowPrice, SlowLength );

{ CB > 1 check used to avoid spurious cross confirmation at CB = 1 }
if CurrentBar > 1 and FastAvg crosses under SlowAvg then
Sell short 1 contract next bar at market;
setstoploss ();
setprofittarget ();


{ ** Copyright © TradeStation Technologies, Inc. All Rights Reserved **
** TradeStation reserves the right to modify or overwrite this strategy component
with each release. ** }

end;

Reply With Quote

Can you help answer these questions
from other members on futures io?
NT8 Order Management Strategy
The Elite Circle
Big Mo Indicator for NT8
NinjaTrader
in depth understanding of last, bid, and ask volume in c …
NinjaTrader
help with take profit several targets
TradeStation
Multi Time Frame High/Low/Median levels
NinjaTrader
 
 
(login for full post details)
  #2 (permalink)
 kjhosken 
Seattle, WA/USA
 
Experience: Intermediate
Platform: TOS, TS
Trading: Forex, crude
 
Posts: 95 since Sep 2016
Thanks: 7 given, 35 received

I think this is your problem, there isn't any variable or input placed in the target and stop functions. Put your profit and stop inputs inside the parentheses.


yeli View Post

setstoploss ();
setprofittarget ();


Follow me on Twitter Reply With Quote
The following user says Thank You to kjhosken for this post:
 
(login for full post details)
  #3 (permalink)
yeli
Milano, Italy
 
 
Posts: 4 since Apr 2021
Thanks: 44 given, 0 received


Thanks so much for the reply. I left the variables out because i change them all the time..doesn't work also when all variables are filled..

Reply With Quote
 
(login for full post details)
  #4 (permalink)
Shaban
Turin + Italy
 
 
Posts: 177 since Feb 2020
Thanks: 20 given, 108 received

Ciao,

se ho capito bene, per quanto concerne lo Stoploss ed il ProfitTarget, dovresti inserirli in questo modo (così li puoi anche ottimizzare):

Inputs: exit_proft(500), Amount(250);




SetProfitTarget (exit_proft);
SetStopLoss(Amount);

--------------------------------------------

A parte lo Stoploss ed il ProfitTarget, il resto della formula funziona correttamente?

P.S: hai un M.P.

Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > Adding daily profit & daily loss targets to code


Last Updated on June 24, 2021


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
     



Copyright © 2023 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
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