Jump to content
Medved Trader Forums

Recommended Posts

Hi all.

I want to create a continuous scanner for the breakout of the previous 1min candle low 

In TD Ameritrade ThinkorSwim i have created this:

#Wizard text: Current bar's
#Wizard input: price1
#Wizard text: gaps  
#Wizard input: percentage
#Wizard text: % or more above the previous
#Wizard input: price2

input price1 = close;
input percentage = 2.0;
input price2 = low;
def x = 1 + percentage / 100;
def term = x * price2[1];
plot scan = price1 > term;

In Medved Trader i have tried:

public void MainCalculation()
    if (Close > Low[1]*1.02)
        SetColorAndShape("Brakeout", PBShape.ArrowNE, 0xFF00C50C);

It does not seem to work because i need to create a variable X , where X = Low[1] * 1.02 // >2% procent of the previous 1min candle low //

The problem is that it does not let me define this variable

Therefore after it will be simple as i can do if(Close > X) {....}

Link to comment
Share on other sites

Code.txtI tried using this page for hints:https://www.medvedtrader.com/trader/WebHelp/index.html?chart_trading.htm

I can't get it to work the way I think it should work. If I use + instead of * it works a little, but I know that's not what you want. 

Just trying to learn.  Sorry I couldn't be of more help.





Edited by L W
Added Code. Could not paste.
Link to comment
Share on other sites

Hi Mike

Yes, i can discribe it.

In Thinkorswim i have created a scanner that works flawless for searching the 1min brakeouts

One of the conditions is the code mentioned above which in words sounds like this:

- Scan all the stocks that have the price of current 1 min candle greater then the Low of the last 1 min candle with a procentage of X

Ex with x=2% : Last 1min candle's Low is 3 then if the current 1min candle price(last) is >3.06 it will display the stock

Ex with x=20% : Last 1min candle's Low is 3 the if the current 1min candle price(last)  is >3.6 it will be displayed as a brakeout

Link to comment
Share on other sites

This is an example that i use in ThinkOrSwim , and it works !

The only problem there is that you constantly need to hit Scan

Also in Medved we need to find a way to sort the results from the Scan upwards from the entire watchlist (it would be helpful if there are 1500 tickers in the watchlist not to scroll down to check all of the tickers and the result of the scanner but to sort the one the fit the scanner criteria upwords)

tos scanner.JPG

Edited by mazilumbogdan
Link to comment
Share on other sites

public void MainCalculation()

    // this parameter will show in the scan/paintbar parameter editor and can be changed by the user

    DefinePaintbarParameter("PCT", "Percentage", false, 0, 200, 1, 0.2);

    // get the percent paramer

    var Per = GetPaintbarParameter("PCT");

    if (Close > Low[1] * (1 + Per/100))
        SetColorAndShape("Breakeout", PBShape.ArrowNE, 0xFF00C50C);


As for your other suggestion - you can either sort on the scan column or filter the portfolio so that only the rows that have some scan result show.


Link to comment
Share on other sites

  • 2 weeks later...

OK so basically what this code is doing is scanning for the last low on the chart and then checking to see if the current candle is X% above that???
Please explain if I am wrong, because I have been trying to do something similar for Crypto for Binance:

if (SymbolData.Volume > 100000 && Open > Close[2] && (MFI_Line[2] <= 20 || RSI_Line[2] <= 35))
I trade Dips only with Crypto.
1. Is there a way to scan for Red or Green candles??? Because (Open > Close[2]) could also be 3 red candles.

Edited by CryptoDips
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...