NexusFi: Find Your Edge


Home Menu

 





please help me convert easy language to pine script


Discussion in Platforms and Indicators

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




 
Search this Thread

please help me convert easy language to pine script

  #1 (permalink)
ronaldo
tel aviv, israel
 
Posts: 4 since Nov 2022
Thanks Given: 1
Thanks Received: 0

It's simple MA with confirm bars:

{ Buys if Price crosses over Avg and then stays above Avg for one or more bars }

inputs:
Price( Close ) [DisplayName = "Price", ToolTip =
"Enter an EasyLanguage expression to use in the moving average calculations."],
Length( 9 ) [DisplayName = "Length", ToolTip =
"Enter the number of bars used in the calculation of the moving average."],
ConfirmBars( 1 ) [DisplayName = "ConfirmBars", ToolTip =
"Enter the number of bars required to confirm the cross of price above the moving average."];

variables:
Counter( 0 );

if Price > AverageFC( Price, Length ) then
Counter = Counter + 1
else
Counter = 0;

{ CB > ConfirmBars check used to avoid spurious cross confirmation at
CB = ConfirmBars }
if CurrentBar > ConfirmBars and Counter = ConfirmBars then
Buy ( !( "MACrossLE" ) ) next bar at market;

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
REcommedations for programming help
Sierra Chart
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
What broker to use for trading palladium futures
Commodities
 
  #2 (permalink)
doko94
Mulege, Baja California Sur
 
Posts: 4 since Nov 2022
Thanks Given: 0
Thanks Received: 1

Check this Bars above/below EMA in tradingview, just add the strategy entry and modify the ema for ma

Reply With Quote
Thanked by:
  #3 (permalink)
ronaldo
tel aviv, israel
 
Posts: 4 since Nov 2022
Thanks Given: 1
Thanks Received: 0



doko94 View Post
Check this Bars above/below EMA in tradingview, just add the strategy entry and modify the ema for ma

tnx for the help !
any idea why alert is warning about repaint ?
what's to repaint in simple MA ?

Reply With Quote
  #4 (permalink)
 
syswizard's Avatar
 syswizard 
Philadelphia PA
 
Experience: Advanced
Platform: Multicharts
Broker: Ironbeam, Rithmic
Trading: Emini ES / NQ / CL / RTY / YM / BTC
Posts: 344 since Jan 2019
Thanks Given: 20
Thanks Received: 146

Where is the Sell logic or other exits ?
Also, you don't check for MarketPosition so the current logic could trigger multiple entries.

Reply With Quote
  #5 (permalink)
ronaldo
tel aviv, israel
 
Posts: 4 since Nov 2022
Thanks Given: 1
Thanks Received: 0


syswizard View Post
Where is the Sell logic or other exits ?
Also, you don't check for MarketPosition so the current logic could trigger multiple entries.


It's not yet a strategy, just an indicator with alerts.

not sure why repaint issue

Reply With Quote
  #6 (permalink)
 
syswizard's Avatar
 syswizard 
Philadelphia PA
 
Experience: Advanced
Platform: Multicharts
Broker: Ironbeam, Rithmic
Trading: Emini ES / NQ / CL / RTY / YM / BTC
Posts: 344 since Jan 2019
Thanks Given: 20
Thanks Received: 146


ronaldo View Post
It's not yet a strategy, just an indicator with alerts.

Then you need to have this statement : Buy ( !( "MACrossLE" ) ) next bar at market;
replaced with a Plot1 statement and then set the colors with SetPlotColor(1,Green) for bullish
and SetPlotColor(1,Red) for bearish.

Reply With Quote




Last Updated on November 12, 2022


© 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