Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

bharatk8

Pl. Correct Amibroker Code Which Distorts Chart View.

Recommended Posts

Hi

My code has Monthly,Weekly,Daily MTF lines.These MTF lines compress chart view.I have tried various scale options to correct this but theses attempts have failed to deliver desired results.Pl. suggest ways to plot only those MTF lines which are close to(40 pips below/above) current bar only.

_SECTION_BEGIN( "Monthly BB" );

 

TFm = inMonthly ;

 

TimeFrameSet( TFm );

 

ShowBBm9F = ParamToggle( "BB9 MTFm F", "Hide|Show", 1 );

ShowBBm9L = ParamToggle( "BB9 MTFm L", "Hide|Show", 1 );

PMTFm9 = Param( "Periom9 MTFm", 9, 2, 30, 1 );

WMTFm9 = Param( "Width9 MTFm", 1.5, 0, 10, 0.05 );

ShowBBm20F = ParamToggle( "BB20 MTFm F", "Hide|Show", 1 );

ShowBBm20L = ParamToggle( "BB20 MTFm L", "Hide|Show", 1 );

PMTFm20 = Param( "Periom20 MTFm", 20, 2, 30, 1 );

WMTFm20 = Param( "Width20 MTFm", 2, 0, 10, 0.05 );

Mm9 = WMA( C, PMTFm9 );

sdm9 = StDev( C, PMTFm9 );

Topm9 = Mm9 + WMTFm9 * sdm9;

Botm9 = Mm9 - WMTFm9 * sdm9;

Mm20 = WMA( C, PMTFm20 );

sdm20 = StDev( C, PMTFm20 );

Topm20 = Mm20 + WMTFm20 * sdm20;

Botm20 = Mm20 - WMTFm20 * sdm20;

 

TimeFrameRestore();

 

Mm9Fm = TimeFrameExpand( Mm9, TFm, expandFirst );

TP9Fm = TimeFrameExpand( TOPm9, TFm, expandFirst );

BT9Fm = TimeFrameExpand( BOTm9, TFm, expandFirst );

Mm20Fm = TimeFrameExpand( Mm20, TFm, expandFirst );

TP20Fm = TimeFrameExpand( TOPm20, TFm, expandFirst );

BT20Fm = TimeFrameExpand( BOTm20, TFm, expandFirst );

Mm9lm = TimeFrameExpand( Mm9, TFm, expandLast );

TP9lm = TimeFrameExpand( TOPm9, TFm, expandLast );

BT9lm = TimeFrameExpand( BOTm9, TFm, expandLast );

Mm20lm = TimeFrameExpand( Mm20, TFm, expandLast );

TP20lm = TimeFrameExpand( TOPm20, TFm, expandLast );

BT20lm = TimeFrameExpand( BOTm20, TFm, expandLast );

if ( ShowBBm9F )

//Plot( Mm9Fm, "MID BANm9 monthly First", colorOrange, styleLine| styleDashed | styleNoRescale );//styleDots |

if ( ShowBBm9F )

//Plot( TP9Fm, "TOP BANm9 monthly First", colorDarkRed, styleLine| styleDashed | styleNoRescale );//styleDots|

if ( ShowBBm9F )

//Plot( BT9Fm, "BOT BANm9 monthly First", colorDarkOliveGreen, styleLine | styleDashed| styleNoRescale );//styleDots|styleDashed |

if ( ShowBBm9L )

//Plot( Mm9lm, "MID BANm9 monthly Last", colorOrange, styleLine | styleDots | styleThick | styleNoRescale );

if ( ShowBBm9L )

//Plot( TP9lm, "TOP BANm9 monthly Last", colorOrange, styleLine | styleDots | styleThick | styleNoRescale );

if ( ShowBBm9L )

//Plot( BT9lm, "BOT BANm9 monthly Last", colorOrange, styleLine | styleDots | styleThick | styleNoRescale );

if ( ShowBBm20F )

//Plot( Mm20Fm, "MID BANm20 monthly First", colorBrown, styleLine | styleNoRescale );//styleDots |

if ( ShowBBm20F )

//Plot( TP20Fm, "TOP BANm20 monthly First", colorBrown, styleLine | styleNoRescale );

if ( ShowBBm20F )

//Plot( BT20Fm, "BOT BANm20 monthly First", colorBrown, styleLine | styleNoRescale );//styleDots |

if ( ShowBBm20L )

//Plot( Mm20lm, "MID BANm20 monthly Last", colorBrown, styleLine | styleDots | styleThick | styleNoRescale );

if ( ShowBBm20L )

//Plot( TP20lm, "TOP BANm20 monthly Last", colorBrown, styleLine | styleDots | styleThick | styleNoRescale );

if ( ShowBBm20L )

//Plot( BT20lm, "BOT BANm20 monthly Last", colorBrown, styleLine | styleDots | styleThick | styleNoRescale );

Share this post


Link to post
Share on other sites

I have tried following options mentioned in manual.But I have not received desired view.I have to keep adjusting Yaxis values in parameter window otherwise sometimes I can can hardly see candle.(see image)Pl. suggest necessary tweaking options.

 

Code 1:

mid1 = WMA( C, Period1 );

sd1 = StDev( C, Period1 );

Top1 = mid1 + Width1 * sd1;

Bot1 = mid1 - Width1 * sd1;

minimum = HighestVisibleValue( .99 * Bot1 );

maximum = LowestVisibleValue( 1.01 * Top1 );

 

HHm = ( TimeFrameGetPrice( "H", inMonthly, -1 ) ) ;

Plot( HHm, "High", colorBlack, styleDots, Minimum, Maximum);

 

Code 2:

 

Plot(IIf(HHm< HighestVisibleValue(Top1) AND HHm > LowestVisibleValue(Bot1),LL,Null ) , "HHm", colorBlack, styleLine | styleDots | styleThick );

 

P.S.I am not able to upload code due to some uploading issue.

5aa712740f273_allclouds.thumb.png.0ea942765476956a82e5899f0f8e2a7f.png

Share this post


Link to post
Share on other sites
I have tried following options mentioned in manual.But I have not received desired view.I have to keep adjusting Yaxis values in parameter window otherwise sometimes I can can hardly see candle.(see image)Pl. suggest necessary tweaking options.

 

Code 1:

mid1 = WMA( C, Period1 );

sd1 = StDev( C, Period1 );

Top1 = mid1 + Width1 * sd1;

Bot1 = mid1 - Width1 * sd1;

minimum = HighestVisibleValue( .99 * Bot1 );

maximum = LowestVisibleValue( 1.01 * Top1 );

 

HHm = ( TimeFrameGetPrice( "H", inMonthly, -1 ) ) ;

Plot( HHm, "High", colorBlack, styleDots, Minimum, Maximum);

 

Code 2:

 

Plot(IIf(HHm< HighestVisibleValue(Top1) AND HHm > LowestVisibleValue(Bot1),LL,Null ) , "HHm", colorBlack, styleLine | styleDots | styleThick );

 

P.S.I am not able to upload code due to some uploading issue.

 

Please give a proper code, not a buged code, expect people to help you.

 

The distortions is very easy - add a style no rescale.

Share this post


Link to post
Share on other sites

Pl. see image.

 

Chart on left is a view of my original AFL with styleNoReScale.I have changed yaxis parameters(minimum/maximum values of yaxis) for proper view.

 

Chart on right is a view of AFL with styleOwnScale.This AFL gives a view which is easy on eye and I do not need to change yaxis parameters for view.

 

But on close inspection,it becomes apparent that,MTF lines and cloud plots are not positioned correctly with reference to close of candle.

 

Pl. help

LAST TRY.txt

view.thumb.png.9de8f86c83ded4fafd5a41ac297b4441.png

Share this post


Link to post
Share on other sites

Hi

 

After all sort of experiments,view of chart has improved to some extent.But I think i should go for "ZOOM RECENT BARS".This feature is available in several softwares/terminals.May I have code for it?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Topics

  • Posts

    • I traded alot today. 9 trades, 8 losers and BEs, 1 runner that paid for them all. Gotta keep swinging! totaled 240 bps before commission. The first winner on W, I did not count - it was a mistake that led to profit. I felt like a machine, kept pulling the trigger, watch the 1min chart, see it doesn't go anywhere, take my small loss... over and over... then one takes off... Let it run... the whole time I was thinking I hope that the one winner will pay for all the losers. I was tempted to close out the winner early. I had no idea that the payoff distribution for this strategy would be so extreme - 8 tiny losses before hitting a big win. Pays to keep the losses tiny and keep swinging. 
    • Date : 22nd February 2019.

      MACRO EVENTS & NEWS OF 22nd February 2019.



      FX News Today Both Topix and Nikkei, declined during the Asian session, with -0.25% and -0.18% respectively. Overall, stock markets in Asia struggled through most of the session as subdued inflation data rekindled concerns about a lack of demand and flagging growth and after Wall Street closed in the red. News that US President Trump will meet with China’s top trade negotiator today in Washington seems to have helped Chinese markets to stage a late rally and CSI 300 and Shanghai Comp are up 1.76% and 1.51% respectively and the Hang Seng also managed to claw back losses and is up 0.11%. US stock futures are posting marginal gains and the April WTI future is trading at just over USD 57 per barrel. USDCAD rallied over 1.32 to 1.3225, as Oil inventories rose, with the US at record production levels. Oil price is now back around the $57 mark. Japanese CPI data same as forecasts, pushing the Yen higher. Charts of the Day


      Main Macro Events Today EU CPI Inflation – Core inflation is expected to be confirmed at 1.1% y/y while the overall inflation rate is expected to have stood at 1.4% in January. Canadian Retail Sales – Retail Sales are expected to have declined by 0.3% m/m in December, an improvement from the 0.6% declined observed in November. Mario Draghi Speech – The ECB President is due to speak to the University of Bologna where he will accept an honourary degree. Support and Resistance
       
      Always trade with strict risk management. Your capital is the single most important aspect of your trading business.

      Please note that times displayed based on local time zone and are from time of writing this report.

      Click HERE to access the full HotForex Economic calendar.

      Want to learn to trade and analyse the markets? Join our webinars and get analysis and trading ideas combined with better understanding on how markets work. Click HERE to register for FREE!

      Click HERE to READ more Market news.

      Dr Nektarios Michail
      Market Analyst
      HotForex

      Disclaimer: This material is provided as a general marketing communication for information purposes only and does not constitute an independent investment research. Nothing in this communication contains, or should be considered as containing, an investment advice or an investment recommendation or a solicitation for the purpose of buying or selling of any financial instrument. All information provided is gathered from reputable sources and any information containing an indication of past performance is not a guarantee or reliable indicator of future performance. Users acknowledge that any investment in FX and CFDs products is characterized by a certain degree of uncertainty and that any investment of this nature involves a high level of risk for which the users are solely responsible and liable. We assume no liability for any loss arising from any investment made based on the information provided in this communication. This communication must not be reproduced or further distributed without our prior written permission.
    • Actions for the 21st. 
    • Today had 3 trades, + 73 bps. The 2nd red dot on ALB was an error, somehow 1 share got executed at the lower price. I started new batch of trades today. The tweak was the exit is now based on trailing exit instead of manually calling it. I found it to be extremely uncomfortable as I sat through each retracement on DPZ. To see profit retrace back to zero or negative is associated with much pain. It feels as if it's a permanent loss. My goal is to execute my trading plan and not trade based on my emotions. I am very proud of the 2nd exit on DPZ for 170bps. I will do my best to continue this work. I do notice I may be giving back a bit too much on my losers, I will not change anything until the next batch of trades.   
    • I forgot to post yesterday. I was down 72 bps.  
×

Important Information

By using this site, you agree to our Terms of Use.